Consider the following file:
$ LESS= \less test
abc
def
abc
By default, searching /abc
in less
will jump to line 3 since /pattern
search starts at second line according to man 1 less
:
/pattern
[... snipped ...] The search starts at the second line displayed (but see the
-a and -j options, which change this).
-a
and -j
do not help.
It's annoying that I have to do a backward search (N) after each /pattern
search to make sure I have not missed anything important in the first line.
How do I make less
pattern search starts at first line displayed?
Edit:
less
version:
$ less --version
less 436
Copyright (C) 1984-2009 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
less
("less 458 (GNU regular expressions)") says "The search starts at the first line displayed". And it does what it says: If I go the top and search/LESS
, it stays on the top. What's your version ofless
? I kinda want to make a mental note for this …$ less --version less 436 Copyright (C) 1984-2009 Mark Nudelman
from Debian squeeze-lts