Search Command in Less: See Target Line in Context

  • Thread starter Thread starter nvn
  • Start date Start date
  • Tags Tags
    Search
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
Messages
2,128
Reaction score
32
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.
 
Physics news on Phys.org