bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Feature request for head command


From: Eric Blake
Subject: Re: Feature request for head command
Date: Wed, 21 Jun 2006 04:34:07 +0000

> When you use head to read a certain number of lines out of a pipe
> sometimes it eats more data than you ask it to,
> 
> Well in the first case hello and world were immediately available to
> be read and head -1 read them both into it's buffer before discovering
> that actually it should have stopped at the first newline.

There is nothing in POSIX that requires it to stop at the first newline,
unless stdin is a terminal (in which case stdin defaulted to line-buffering).
This issue has come up before, and it is more than just head that
are affected - parsing for line ends slows down input, and complicates
code, so it should only be done in a general wrapper utility (kind of
like nice or nohup), rather than incorporated into every utility that
can act as a filter:

http://lists.gnu.org/archive/html/bug-coreutils/2006-03/msg00118.html

But so far, no one has implemented something along those lines.

-- 
Eric Blake





reply via email to

[Prev in Thread] Current Thread [Next in Thread]