in reply to RegEx : Filtering a log file

while(<DATA>) { if (/^(\w+.+?(?:AM|PM))\s+(\w+.+?(?:AM|PM))/) { print $1,"\n", $2, "\n___\n"; } } __DATA__ ...

Output

August 26, 2004 1:21:04 AM August 26, 2004 1:22:16 AM ___ September 5, 2004 2:49:03 AM September 5, 2004 2:49:37 AM ___ September 16, 2004 12:32:34 PM September 16, 2004 12:33:26 PM ___ September 16, 2004 4:44:28 PM September 16, 2004 4:44:34 PM

 

Replies are listed 'Best First'.
Re^2: RegEx : Filtering a log file
by Anonymous Monk on Sep 17, 2004 at 11:11 UTC
    Great, Thanks for this

    But The status and the status description was not captured!

      You asked for guidance and help - and that's what you got - now, would you like more explanation or is there something else troubling you?

      I understand RegEx can be a steep learning curve, but if you can ask specific questions I'm sure you will get good answers from those assembled.

      Unfortunately I don't have enough spare time to work through all your requirements one at a time.

       

        Apologies if I sounded a bit patronizing,

        But instead of the printf "%s\t%s\t%s\n", $splited[0],$splited[$#splited-1], $splited[$#splited]; I thought by using Regex can speed it up and makes it more efficient.

        Thanks for your help, I have learnt something from it.

        Regards