Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Reading a Log File - "pattern detection" Part 2

by Aim9b (Monk)
on Jul 01, 2008 at 17:29 UTC ( [id://694987]=note: print w/replies, xml ) Need Help??


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. ;-)
  • Comment on Re: Reading a Log File - "pattern detection" Part 2

Replies are listed 'Best First'.
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://694987]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-26 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found