in reply to Re: trouble parsing log file...
in thread trouble parsing log file...
Well, if you're looking for a pattern instead of an exact string, you can look into regular expressions.
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
For example, to match the string "server is DOWN" anywhere in the line:
if ($line =~ /server is DOWN/) { $got_button = 1; print $redbutton; last; }
... and you can ignore case (eg. match "Server IS down" and "SERVER is Down" both) by adding i at the end:
if ($line =~ /server is DOWN/i) { $got_button = 1; print $redbutton; last; }
But definitely look into regular expressions, which will open up a whole world for you in terms of pattern-matching power.
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: trouble parsing log file...
by perl_geoff (Acolyte) on Nov 20, 2006 at 20:58 UTC | |
by liverpole (Monsignor) on Nov 20, 2006 at 22:06 UTC | |
by SheridanCat (Pilgrim) on Nov 20, 2006 at 22:05 UTC | |
Re^3: trouble parsing log file...
by perl_geoff (Acolyte) on Nov 21, 2006 at 15:56 UTC | |
by McDarren (Abbot) on Nov 21, 2006 at 16:04 UTC | |
by perl_geoff (Acolyte) on Nov 21, 2006 at 18:21 UTC | |
by jarich (Curate) on Nov 23, 2006 at 14:41 UTC | |
by perl_geoff (Acolyte) on Nov 28, 2006 at 13:43 UTC |
In Section
Seekers of Perl Wisdom