Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Search command in less

  1. Sep 24, 2009 #1

    nvn

    User Avatar
    Science Advisor
    Homework Helper

    When perusing a file using the linux less command, and you use the less search command inside less, I would like to know how to make less not display the line containing the target search string as the very top line of the session window (very poor design). I want the target line to always be at least the fourth line down from the top of the window (or lower), so I can see the found string in context, showing a few lines before (and after) the target line. Any help would be appreciated.
     
  2. jcsd
  3. Sep 25, 2009 #2

    nvn

    User Avatar
    Science Advisor
    Homework Helper

    Problem solved. The problem is solved by using the less -jn option, explained on the less man page.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Search command in less
Loading...