in reply to log search
this task can be accomplished with a perl one-liner:
perl -ne"/error|warning/i && print" rc.logbut if you'd like to make it a script, with full error checking, i might do something like:
#!/opt/perl5/bin/perl5.005 -w use strict; use warnings; $|++; ## process each file passed on command line for my $file ( @ARGV ) { ## open the file for reading open( RC => "<", $file ) or die "Can't open $file"; ## print the program name and current file to be processed print "$0: $file\n"; ## print errors and warnings while(<RC>) { print if /error|warning/i } close RC; }
~Particle *accelerates*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: log search
by Aristotle (Chancellor) on Jun 16, 2003 at 14:06 UTC |