use File::ReadBackwards; my $file_name = "filename"; my $fh = File::ReadBackwards->new($file_name) or die("Unable to read log file $file_name: $!"); my @lines = reverse grep /foo/, grep defined, map { scalar $fh->readline() } 1..10;
Update: Oops, I wrongly assumed -f worked the same way as in tar. My snippet emulates
tail "filename" | grep "foo"
rather than the desired
tail -f "filename" | grep "foo"
Disregard this post.
In reply to Re: Perl equivilant to tail -f
by ikegami
in thread Perl equivilant to tail -f
by jklcrash
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |