[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit
From: |
Stefan Tomanek |
Subject: |
Re: [coreutils] [PATCH] head: optionally indicate underrun of set limit |
Date: |
Thu, 25 Nov 2010 17:17:31 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Dies schrieb Pádraig Brady (address@hidden):
> 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 a side effect of the method
I described.
> The following addresses both issues and
> also uses existing coreutils functionality:
>
> 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_part
> done
>
> cheers,
> Pádraig.
>
> p.s. \x is not a printf standard so the
> script probably needs tweaking for dash
That's actually a neat idea, I'll see if I can adapt this
for my purpose. But you must admit that having a modified
'head' to replace the od/test/echo/printf part would be a
nice thing?