3

When I search a file in less or more, it will remove lines and replace them with "skipping". Does anyone know what causes this and/or how to avoid it?

After I '/' search a log file using either more or less, I see this:

crw-rw-rw-    1 root     staff        40,  0 Oct 27 2013  fscsi0
crw-rw-rw-    1 root     staff        40,  1 Oct 27 2013  fscsi1
brw-rw----    1 root     system       10,  9 Oct 27 2013  hd1
...skipping...
crw-rw-rwT    1 root     system       38,  7 Oct 27 2013  vhost7
crw-rw-rwT    1 root     system       38,  8 Oct 27 2013  vhost8
crw-rw-rwT    1 root     system       38,  9 Oct 27 2013  vhost9
crw-------    1 root     system       12,  0 Oct 27 2013  vio0
crw-------    1 root     system       20,  0 Apr  5 00:53 vty0
drwxr-xr-x    2 root     system          256 Oct 15 2008  xti
crw-rw-rw-    1 root     system        2,  3 Oct 27 2013  zero
...skipping...
crw-rw-rwT    1 root     system       38,  7 Oct 27 2013  vhost7
crw-rw-rwT    1 root     system       38,  8 Oct 27 2013  vhost8
crw-rw-rwT    1 root     system       38,  9 Oct 27 2013  vhost9
  • Are you quite certain that the ...skipping... lines are not present in the file itself? – Wildcard Apr 5 '16 at 21:46
  • Yes, it only shows skipping when I search. If I open the file in vi, there are no lines that contain '...skipping...'. – kdoggett Apr 5 '16 at 21:51
6

Those "skipping" lines are perfectly normal.

Searching for some string is much faster than displaying each and every line on screen. Therefore if you search for a word, less will scan the file for that word and once it finds a line it will display only that page of lines where it found the word.

If you scroll back using your terminal you will see those "skipping" lines.

If you want to go backwards in your text just use the proper keys like arrow keys. This will move you through the text as it is without any "skipping"s.

PS: You can type h in less for a list of keys and what they do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.