in reply to Re: Tricky Syslog Parsing
in thread Tricky Syslog Parsing
my $file = 'd:\PROGRA~1\Syslogd\Logs\syslog22Dec2003.txt'; open (FILE, $file) or die "Can't open $file: $!\n"; my %messages; while(<FILE>) { /(FW\-\d+\-\d+)/; # extract MSG ID next if exists($messages{$1}); # ignore it if we've $messages{$1} = $1; # already seen it. } my $count; open (FILE, $file) or die "Can't open $file: $!\n"; for my $i (keys %messages){ print "\n$i:\n\n"; $count = 0; while(<FILE>){ if (/$i/){ print "$_\n"; $count++; } last if $count == 1; } } close FILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Tricky Syslog Parsing
by elwarren (Priest) on Jan 13, 2004 at 21:39 UTC |