On 08/03/2010 14:21, Gabor Kovesdan wrote:
Em 2010.08.03. 19:25, [email protected] escreveu:
Hi,
It seems bsdgrep does not work when piped from tail -f.
I'm running r210728.
term0$ jot 10> /tmp/1
term0$ tail -f /tmp/1 | grep 0
[no output]
otherterm$ jot 10>> /tmp/1
[no output to term0]
=====
with GNU grep:
term0$ tail -f /tmp/1 | gnugrep 0
10
otherterm$ jot 10>> /tmp/1
[on term0]
10
10
I've checked on 8.0 and GNU grep doesn't output anything either for me.
If you use tail -f, you will enter more lines and end it with EOF, won't
you? And then BSD grep will process the input and print out matches. I
don't think it's bad behaviour in itself but if you can explain why you
think it's bad I'm willing to change it.
This is a common functionality gnu-grep. tail -f never exits and grep
keeps grepping until it gets a EOF which is never hit unless you ^C.
A good example for such a use is monitoring a all.log log while looking
for non-exact situations. something like
% tail -f all.log |egrep -v "(sendmail|sm-mta|cron)"
which would remove all lines that contain sendmail sm-mta & cron from
the output and continue to read output from tail -f until it is ^C.
You can turn on your all.log through /etc/syslog.conf after creating the
mode 600 file under /var/log for toying with.
There is quite a few other cases but I don't think I need to mention
them. I rely on this for continuous firewall log trolling.
No offense but If the functionality exists in gnu-grep then the same
functionality needs to exist in bsd-grep, ``period''. At least for the
mean-time.
Regards,
--
jhell,v
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[email protected]"