in reply to Reading a Log File - "pattern detection" Part 2
I have a script that searches for a single pattern, then displays the next few lines. It's not a log file, but more of an ini file. I search for "section-name", etc. & then just prints that section, either n lines, or until xxx is found. If you'd like it, I can put it on my scratch pad.
Good luck. I'm in a heavy learning curve myself. ;-)
Re^2: Reading a Log File - "pattern detection" Part 2
by NTGeek (Initiate) on Jul 01, 2008 at 19:00 UTC
|
Essentially, if your log file contained the following:
This is driving me nuts
Its time for coffee
Time to start drinking heavily
. . . and you wanted your script to find one or more "patterns"
then your
print OUT if (/Its time fore coffee/ | /Time to start drinking heavily/);
would need to be included. The "/" are what does the trick along with a decent text editor that will turn different colors when you get things right or wrong.
| [reply] |
|