coreutils
[Top][All Lists]
Advanced

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

Re: [head] wished an option to continue consuming the input after the sp


From: Bob Proulx
Subject: Re: [head] wished an option to continue consuming the input after the specified number of lines has been read
Date: Mon, 15 Oct 2012 21:20:09 -0600
User-agent: Mutt/1.5.20 (2009-06-14)

Hello Thibault,

Please keep the mailing list in the CC list so that everyone can
participate and learn from the discussion.  Thanks.

Thibault LE PAUL wrote:
> The problem was with a tee.
> Here is an example :
> 
> rm /tmp/fifo1
> mkfifo /tmp/fifo1
> cat /tmp/fifo1|(head -20;cat >/dev/null)|sed 's/^/head &/' &
> #(cat /tmp/fifo1|sed -e '21,$d' -e 's/^/head &/') &
> #(cat /tmp/fifo1|awk 'FNR<21{print "head "$0}')&
> tee /tmp/fifo1|tail -20|sed 's/^/tail &/'
> 
> It works with cat, I didn't think to it.

You have shown part of what you are trying.  That is good.  But I
don't see a problem with what you are showing.  Please show us both
what you are expecting and also what you are seeing that you think is
a problem.

Using 'head -20' is problematic usage.  I recommend avoiding it.

I tried this:

  $ mkfifo fifo
  $ cat fifo | head -n1 | sed 's/^/head &/' &
  [1] 20056
  $ printf "foo\nfoo\nfoo\n" > fifo
  head foo
  $
  [1]+  Done                    cat fifo | head -n1 | sed 's/^/head &/'
  $

That all seems reasonable to me.  What problem are you seeing?

Bob



reply via email to

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