in reply to script to grab string from log and print them in a different log
It looks like the only thing left to do is print the matching lines to the output file:
while ( <LOG> ) { if ( $_ =~ /$MAL/i ) { # Grab all strings that contain this regex # Save them all in $out print OUT $_; }
Note that there's no comma "," after the file descriptor OUT.
Does that do what you want?
Update: You don't need the final print OUT "$out"; of course. Also, since the =~ operator works on $_ by default, you could simplify the line containing the regex match to: if (/$MAL/) {.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: script to grab string from log and print them in a different log
by perl_geoff (Acolyte) on Feb 01, 2007 at 16:05 UTC | |
by liverpole (Monsignor) on Feb 01, 2007 at 16:10 UTC | |
by perl_geoff (Acolyte) on Feb 01, 2007 at 16:16 UTC | |
by liverpole (Monsignor) on Feb 01, 2007 at 16:23 UTC | |
by perl_geoff (Acolyte) on Feb 01, 2007 at 16:37 UTC | |
| |
by davorg (Chancellor) on Feb 01, 2007 at 16:20 UTC |