Anoop Sharma wrote: > Head command does not position file pointer correctly for negative line > count. Here is a demonstration of the problem.
The problem doesn't seem to be limited to negative line counts. I replaced the 10 ABC lines by a number sequence to demonstrate this issue clearer. $ seq 10 | ( head -n -2 ; echo xxx ; cat ) 1 2 3 4 5 6 7 8 xxx $ seq 10 | ( head -n 2 ; echo xxx ; cat ) 1 2 xxx So head eats all of the input. The info page is silent about this. Have a nice day, Berny