#!/usr/bin/perl -w use strict; use File::ReadBackwards; my @lines = (); my $n = 10; my $elif = File::ReadBackwards->new('somefile') || die $!; while(defined(my $line = $elif->readline())){ unshift @lines, $line if $line =~ /criteria/; last if @lines >= $n } print @lines;
In reply to Re: last $n lines that match a criteria
by Anonymous Monk
in thread last $n lines that match a criteria
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |