in reply to Log Parsing Help
Update: Actually, no. You need to remove the three lines mentioning $last:
my @history; my $expect = 1; while (<>) { chomp; my ($num) = /EVENT(\d+)/ or next; # Ignore bad input. if ($num == 1 || $num != $expect) { @history = (); $expect = 1; } if ($num == $expect) { push @history, "$_\n"; if ($expect++ == 4) { print(@history); @history = (); $expect = 1; } } }
The funny thing is that I didn't have those three lines originally since I had forgotten that part of your question when I first wrote up my reply.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Log Parsing Help
by dlcasey (Initiate) on Sep 08, 2009 at 17:48 UTC |