Grepping grep output fails
Posted
by viraptor
on Super User
See other posts from Super User
or by viraptor
Published on 2010-02-05T17:46:17Z
Indexed on
2010/04/09
15:44 UTC
Read the original article
Hit count: 367
I'm trying to grep the output of ngrep. Unfortunately when I add another grep to the pipeline, I get no output at all. It can be some other command too - cat / grep / tee - everything breaks the chain. Example:
# this works:
$ ngrep -l -q -T -Wbyline -d any udp and port 5060 |
egrep -B1 '^SIP/2.0 180'
--
U +1.469535 xxx:5060 -> xxx:5060
SIP/2.0 180 Ringing.
--
U +0.001384 xxx:5060 -> xxx:2048
SIP/2.0 180 Ringing.
but
#these don't:
$ ngrep -l -q -T -Wbyline -d any udp and port 5060 |
egrep -B1 '^SIP/2.0 180' | egrep '^U'
$ ngrep -l -q -T -Wbyline -d any udp and port 5060 |
egrep -B1 '^SIP/2.0 180' | cat
$ ngrep -l -q -T -Wbyline -d any udp and port 5060 |
egrep -B1 '^SIP/2.0 180' | tee test
If I use cat somefile
instead of ngrep at the start, everything works as expected.
Any ideas what could go wrong here?
© Super User or respective owner