Hello, brothers!
Strange that noone posted this yet, because it seems to be rather useful CUFP. Simple as it sounds: tail -f combined with grep, even with grep -E.
#!/usr/local/bin/perl -w use strict; my $usage = "Usage: gtail <filename> <options for grep>\n"; my $file = shift or die $usage; @ARGV or die $usage; open(TAIL, "tail -f $file|") or die "Can't pipe from tail: $!"; open(GREP, "|grep @ARGV") or die "Can't pipe to grep: $!"; select((select(GREP), $|=1)[0]); while(<TAIL>) { print GREP $_; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: grep'ed tail
by b10m (Vicar) on Apr 25, 2005 at 13:40 UTC | |
by maard (Pilgrim) on Apr 25, 2005 at 15:47 UTC | |
|