8

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
2
  • Are you quite certain that the ...skipping... lines are not present in the file itself?
    – Wildcard
    Commented Apr 5, 2016 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
    Commented Apr 5, 2016 at 21:51

2 Answers 2

13

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.

0
1

For 'less' command, the "...skipping..." output comes from the 'less' code itself. You cannot avoid this.

If you navigate to the bottom of the 'man less' command, you will see the line "http://www.greenwoodsoftware.com/less". This link contains the source code for all 'less' versions. (Your version can be seen at the bottom of the 'man less' command).

You can download your version and check the c code. The line which prints "...skipping..." is located in the forwback.c file. (grep '...skipping...' *.c to see search results) Finally search for the skipping keyword and you will see when it is used.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .