I've been doing this for years, thinking it prints the first few and
last few lines of something:
[EMAIL PROTECTED] ~]$ yes stuff | head -3000 | cat -n | (head -2;tail -2)
     1  stuff
     2  stuff
  2999  stuff
  3000  stuff
[EMAIL PROTECTED] ~]$ 

In this example, the results are what I desire. However,
[EMAIL PROTECTED] ~]$ yes stuff | head -300 | cat -n | (head -2;tail -2)
     1  stuff
     2  stuff
[EMAIL PROTECTED] ~]$ 

I presume this arises because head's reading ahead (if not head, then
glibc on head's behalf), and when head's printed enough lines it simply
closes its files (or maybe just exit()s.

I don't see when this behaviour might actually be desired. I'd like to
see its behaviour changed so that head consumes no more lines than it
will report. (I note the man page is silent on what should happen, no
surprise there).

If you think that the current unpredictable behaviour is sometimes
desirable, then could we please have something, maybe --nobuffer, to
turn it off?

Thank you so much.
 
-- 
John Summerfield <[EMAIL PROTECTED]>



_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to