[coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-14 Thread Stefan Tomanek
It is often convinient to detect whether head has in fact printed the requested number of lines or if EOF was reached before reaching that point. This patch adds the option --indicate-underrun, which makes "head" exit with a status of 4 instead of 0 if no more data could be read from its input. Th

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-23 Thread Stefan Tomanek
Dies schrieb Stefan Tomanek (stefan.toma...@wertarbyte.de): > It is often convinient to detect whether head has in fact printed the > requested number of lines or if EOF was reached before reaching that > point. This patch adds the option --indicate-underrun, which makes > "head" exit with a statu

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-23 Thread Pádraig Brady
On 23/11/10 16:24, Stefan Tomanek wrote: > Dies schrieb Stefan Tomanek (stefan.toma...@wertarbyte.de): > >> It is often convinient to detect whether head has in fact printed the >> requested number of lines or if EOF was reached before reaching that >> point. This patch adds the option --indicate-

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-23 Thread Jim Meyering
Pádraig Brady wrote: > On 23/11/10 16:24, Stefan Tomanek wrote: >> Dies schrieb Stefan Tomanek (stefan.toma...@wertarbyte.de): >> >>> It is often convinient to detect whether head has in fact printed the >>> requested number of lines or if EOF was reached before reaching that >>> point. This patch

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-23 Thread Stefan Tomanek
Dies schrieb Jim Meyering (j...@meyering.net): > > This does seem useful on the face of it. > > I need to do a little further investigation > > to see if there are existing ways to achieve the same. > > For the record, here's a quick one-liner: > > $ seq 2|perl -ne '$n=3; print; $.==$n and $ok

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-24 Thread Pádraig Brady
On 23/11/10 16:34, Pádraig Brady wrote: > On 23/11/10 16:24, Stefan Tomanek wrote: >> Dies schrieb Stefan Tomanek (stefan.toma...@wertarbyte.de): >> >>> It is often convinient to detect whether head has in fact printed the >>> requested number of lines or if EOF was reached before reaching that >>>

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-25 Thread Stefan Tomanek
Dies schrieb Pádraig Brady (p...@draigbrady.com): > I was wondering about the logic in your example BTW. > If there is no input then you'll process an empty chunk > or if the input is an exact multiple of the chunk size > you'll process an empty chunk at the end. Yes, I have to admit that this is

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2010-11-25 Thread Pádraig Brady
On 25/11/10 16:17, Stefan Tomanek wrote: > Dies schrieb Pádraig Brady (p...@draigbrady.com): > >> process_part() { echo processing $(wc -c) bytes; } >> while true; do >> c=$(od -tx1 -An -N1) >> test "$c" || break >> c=$(echo $c) #strip leading ' ' >> { printf "\x$c"; head -c9; } | process_

Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit

2011-05-16 Thread Pádraig Brady
On 24/11/10 16:34, Pádraig Brady wrote: > On 23/11/10 16:34, Pádraig Brady wrote: >> On 23/11/10 16:24, Stefan Tomanek wrote: >>> Dies schrieb Stefan Tomanek (stefan.toma...@wertarbyte.de): >>> It is often convinient to detect whether head has in fact printed the requested number of lines