in reply to regular expression help
Here's a contrived example
#!/usr/bin/perl # Never leave home without these! use strict; use warnings; # Loop through the faux data log, and... while (<DATA>) { # ...find lines that might be interesting... if (/--/) { # ... but ignore certain ones, like those # that say "logging" or "disconnected". unless ( /logging/ || /disconnected/ ) { # Print the rest. print "NOTE: $_"; } } } # Our faux data for this example __DATA__ 081407 start up server 081407 -- fatal error in procedure 1 081407 -- disconnected user 081407 -- logging started 081407 -- not enough space
This produces:
NOTE: 081407 -- fatal error in procedure 1 NOTE: 081407 -- not enough space
Hope this helps,
-v
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regular expression help
by goibhniu (Hermit) on Aug 15, 2007 at 13:49 UTC | |
|
Re^2: regular expression help
by wantamad (Initiate) on Aug 14, 2007 at 19:00 UTC | |
by SuicideJunkie (Vicar) on Aug 14, 2007 at 19:18 UTC |