Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Parsing log files (still)

by Kanji (Parson)
on Jul 06, 2005 at 23:11 UTC ( #472968=note: print w/ replies, xml ) Need Help??


in reply to Re: Parsing log files (still)
in thread Parsing log files (still)

I'd personally use regexp method that GrandFather suggests because it gives me just the data I'm after with the added benefit of (basic) sanity checks, but if you're going to go the split method, using a more complex pattern avoids the need for post-split massaging...

my @result = split /(: |.<|>,)/; my($qid,$email,$status) = @result[2,6,10]; # or my($qid,$email,$status) = (split /(: |.<|>,)/)[2,6,10];

And depending on the extent of your Postfix-log parsing needs, you may be able to save yourself some effort by using or bastardizing pflogsum (assuming you don't find the code too hairy :-)).

    --k.



Comment on Re^2: Parsing log files (still)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-09-19 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (133 votes), past polls