I had a problem once where the digit can be one or two, it was computer generated and when the digit was one character, the space was two, so this might be more reliable...


$line=~/[\w{3} \w{3}\s{1,2}(\d{1,2})\s{1,2}(\d{4})\s{1,2}(\d\d):(\d\d):(\d\d)\]

And if it doesn't do that, it won't hurt :)

ms



At 02:37 AM 10/23/03, you wrote:
Helo.


With Time::Local, you can transform a litteral date in seconds elapsed since origin.
So, just read line by line :


if you find /STRT_TASK: \[(\w*)\]/ (I suppose the task stored $1 is letters only),
use regexp to find day, year hh:mm:ss
I would use $line=~/[\w{3} \w{3} (\d{1,2}) (\d{4}) (\d\d):(\d\d):(\d\d)\] to store day, year hh, mm and ss in $1..$5
There should be more beautiful way but I am not regexp expert


if you find /STOP_TASK\[(\w*)\]/ (I suppose the task is letters only),
        check if the starting task was the same, convert time again

Then calcul the difference in seconds.

Regards,

Christophe GAUDER

-----Message d'origine-----
De : ashish srivastava [mailto:[EMAIL PROTECTED]
Envoyé : jeudi 23 octobre 2003 8:19
À : [EMAIL PROTECTED]
Objet : Regex


Hi ,


I need to parse a log file to get the timing of various tasks. The Format is
as below.

STRT_TASK: [task1] [] [Tue Oct 21 2003 21:16:01]
STOP_TASK: [task1] [] [Tue Oct 21 2003 21:16:01]

STRT_TASK: [task2] [] [Tue Oct 21 2003 21:16:01]
STOP_TASK: [task2] [] [Tue Oct 21 2003 21:16:01

How to get the time diff between STRT_TASK and STOP_TASK for task1?

Any help in this would be greatly appreciated.

-Ashish

_________________________________________________________________
Are you a Citibank RCA member? Want to fly free to India?
http://server1.msn.co.in/sp03/diwali/rca/memberrca.asp Here is how you can!

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to