head behaviour
Dominic Fandrey
kamikaze at bsdforen.de
Tue Jun 8 09:01:41 UTC 2010
On 08/06/2010 00:59, Brian Somers wrote:
> On Mon, 07 Jun 2010 13:05:48 +0200, Dag-Erling Smørgrav <des at des.no> wrote:
>> Bakul Shah <bakul at bitblocks.com> writes:
>>> Except read doesn't do it quite right:
>>>
>>> $ ps | (read a; echo $a ; grep zsh)
>>> PID TT STAT TIME COMMAND
>>
>> yeah, I forgot that it drops leading whitespace...
>
> Well, leading $IFS
>
> $ ps | (IFS= read a; echo "$a"; grep zsh)
>
> works a lot better.
As does using sed, which is the right tool for this kind of job
anyway.
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
More information about the freebsd-hackers
mailing list