I know less +/pattern filename
will open the file and navigate to the first occurrence of the pattern. Is there a way to tell less
to search from the end backwards? Does it even accept more than one +
switch?
Do not work:
less +?pattern filename
less +G +?pattern filename
Best Answer
The
man
page forless
states the syntax isless +?pattern filename
Press
n
to continue to search for the pattern backwards. PressN
to search for the pattern forwards.Example
For testfile.txt of
less +?banana testfile.txt
shows the following: