zsh-users
 help / color / mirror / code / Atom feed
* RE: trouble with multiple pipes
  1999-06-10  0:29 trouble with multiple pipes Dominik Vogt
@ 1999-06-09 16:41 ` Andrej Borsenkow
  1999-06-10  1:08   ` Dominik Vogt
  1999-06-16 20:18 ` dado
  1 sibling, 1 reply; 5+ messages in thread
From: Andrej Borsenkow @ 1999-06-09 16:41 UTC (permalink / raw)
  To: dominik.vogt, zsh-users

> I am using zsh 3.0.5 on a 2.2.5 Linux kernel. I encountered a problem
> when trying to use multiple pipes with and a command that does not
> finish:
>
>   # tail -f foo
>   1
>   2
>   3
>   4
>   5
>   (pressed ^C to stop tail)
>
> Now I don't want to see all lines with a '5':
>
>   # tail -f foo | grep -v 5

I am surprised, that you get any output here. I don't get anything at all.
The problem is, that grep buffers input/output (I won't discuss, if it is a
bug or a feature). So, you won't see anything till the whole buffer is
filled. In my case grep does not do any write at all.

> Unfortunately I need to filter the output from a running
> daemon in this way, but I'm out of ideas.
>

What do you mean? If you need to write the continous output to a file - it
is O.K. As soon, as daemon fills up the whole buffer, it will be written
off.

/andrej


^ permalink raw reply	[flat|nested] 5+ messages in thread

* trouble with multiple pipes
@ 1999-06-10  0:29 Dominik Vogt
  1999-06-09 16:41 ` Andrej Borsenkow
  1999-06-16 20:18 ` dado
  0 siblings, 2 replies; 5+ messages in thread
From: Dominik Vogt @ 1999-06-10  0:29 UTC (permalink / raw)
  To: zsh-users

I am using zsh 3.0.5 on a 2.2.5 Linux kernel. I encountered a problem
when trying to use multiple pipes with and a command that does not
finish:

E.g. I have a file foo:

  # cat foo
  1
  2
  3
  4
  5

Now I want to view that file with "tail -f" so that I get all lines
that are written to the file too:

  # tail -f foo
  1
  2
  3
  4
  5
  (pressed ^C to stop tail)

Now I don't want to see all lines with a '5':

  # tail -f foo | grep -v 5
  1
  2
  3
  4
  (pressed ^C to stop tail)

And now I want to remove '4' from the output too:

  # tail -f foo | grep -v 5 | grep -v 4
  (no output generated, pressed ^C)

But when I terminate 'tail'
  # killall tail
  1
  2
  3
  zsh: terminated  tail -f foo | 
  zsh: done        grep -v 5 | grep -v 4

Why doesn't get the output of the first pipe get through to
the second one? Any ideas how to circumvent this problem?
Unfortunately I need to filter the output from a running
daemon in this way, but I'm out of ideas.

The same behaviour occurs on HP-UX 10.20 (not that I think the
OS matters) or with ksh or bash.

Please respond to me personally, I'm not on the list.

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, dominik_vogt@hp.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: trouble with multiple pipes
  1999-06-09 16:41 ` Andrej Borsenkow
@ 1999-06-10  1:08   ` Dominik Vogt
  0 siblings, 0 replies; 5+ messages in thread
From: Dominik Vogt @ 1999-06-10  1:08 UTC (permalink / raw)
  To: zsh-users

On Wed, Jun 09, 1999 at 08:41:58PM +0400, borsenkow.msk@sni.de wrote:
> > I am using zsh 3.0.5 on a 2.2.5 Linux kernel. I encountered a problem
> > when trying to use multiple pipes with and a command that does not
> > finish:
> >
> >   # tail -f foo
> >   1
> >   2
> >   3
> >   4
> >   5
> >   (pressed ^C to stop tail)
> >
> > Now I don't want to see all lines with a '5':
> >
> >   # tail -f foo | grep -v 5
> 
> I am surprised, that you get any output here. I don't get anything at all.
> The problem is, that grep buffers input/output (I won't discuss, if it is a
> bug or a feature). So, you won't see anything till the whole buffer is
> filled. In my case grep does not do any write at all.

Ah, yes, of course.

> > Unfortunately I need to filter the output from a running
> > daemon in this way, but I'm out of ideas.
> 
> What do you mean? If you need to write the continous output to a file - it
> is O.K. As soon, as daemon fills up the whole buffer, it will be written
> off.

Hm, I'd like to see the output in real-time as well as to log it in a file.
I'll make up some kind of script using only zsh builtins :-)

Thanks

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, dominik_vogt@hp.com


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: trouble with multiple pipes
  1999-06-10  0:29 trouble with multiple pipes Dominik Vogt
  1999-06-09 16:41 ` Andrej Borsenkow
@ 1999-06-16 20:18 ` dado
  1999-06-16 22:22   ` Dominik Vogt
  1 sibling, 1 reply; 5+ messages in thread
From: dado @ 1999-06-16 20:18 UTC (permalink / raw)
  To: dominik.vogt; +Cc: zsh-users

Dominik Vogt wrote:

> (snip)

have you tried egrep ?

# tail -f foo | egrep -v "5|4"

> And now I want to remove '4' from the output too:
>
>   # tail -f foo | grep -v 5 | grep -v 4
>   (no output generated, pressed ^C)
>
> But when I terminate 'tail'
>   # killall tail
>   1
>   2
>   3
>   zsh: terminated  tail -f foo |
>   zsh: done        grep -v 5 | grep -v 4
>
> Why doesn't get the output of the first pipe get through to
> the second one? Any ideas how to circumvent this problem?
> Unfortunately I need to filter the output from a running
> daemon in this way, but I'm out of ideas.
>
> The same behaviour occurs on HP-UX 10.20 (not that I think the
> OS matters) or with ksh or bash.
>
> Please respond to me personally, I'm not on the list.
>
> Bye
>
> Dominik ^_^
>
> --
> Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
> Herrenberger Str.130, 71034 Boeblingen, Germany
> phone: 07031/14-4596, fax: 07031/14-3883, dominik_vogt@hp.com

--
________________________________________________________________________
Dado Feigenblatt           dado@pdi.com            direct (650) 846-8386
Technical Lighter                              front desk (650) 846-8100
PDI - Palo Alto, CA                                   fax (650) 846-8101




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: trouble with multiple pipes
  1999-06-16 20:18 ` dado
@ 1999-06-16 22:22   ` Dominik Vogt
  0 siblings, 0 replies; 5+ messages in thread
From: Dominik Vogt @ 1999-06-16 22:22 UTC (permalink / raw)
  To: dado, zsh-users

On Wed, Jun 16, 1999 at 01:18:18PM -0700, dado wrote:
> Dominik Vogt wrote:
> 
> > (snip)
> 
> have you tried egrep ?

Yes, it works, but that doesn't really help since there are more
commands (other than grep) in the pipe I use. Anyway, I
solved the problem by writing a zsh script that does the filtering
with builtin commands :) (zsh is really *great*)

> # tail -f foo | egrep -v "5|4"
> 
> > And now I want to remove '4' from the output too:
> >
> >   # tail -f foo | grep -v 5 | grep -v 4
> >   (no output generated, pressed ^C)
> >
> > But when I terminate 'tail'
> >   # killall tail
> >   1
> >   2
> >   3
> >   zsh: terminated  tail -f foo |
> >   zsh: done        grep -v 5 | grep -v 4
> >
> > Why doesn't get the output of the first pipe get through to
> > the second one? Any ideas how to circumvent this problem?
> > Unfortunately I need to filter the output from a running
> > daemon in this way, but I'm out of ideas.
> >
> > The same behaviour occurs on HP-UX 10.20 (not that I think the
> > OS matters) or with ksh or bash.

Bye

Dominik ^_^

--
Dominik Vogt, dominik.vogt@gmx.de
Reply-To: dominik.vogt@gmx.de


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-06-16 22:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-10  0:29 trouble with multiple pipes Dominik Vogt
1999-06-09 16:41 ` Andrej Borsenkow
1999-06-10  1:08   ` Dominik Vogt
1999-06-16 20:18 ` dado
1999-06-16 22:22   ` Dominik Vogt

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).