achak01 has asked for the wisdom of the Perl Monks concerning the following question:
I need to get the date time values. How do i proceed so whatever be the format, i can grep the date time value. Hello Monks. I have got it working Here is my code snippetScript /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/25/11 14:36:48 <code> or <code> Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/25/11 +14:36:48
open(INFILE,"install.log")|| die("File not found"); while($line = <INFILE>) { if ($line =~ /((\d+)\/(\d+)\/(\d+))\Z/g) { $match = $&; $nextline = <INFILE>; $start="$match$nextline"; if($start =~ /(\d+)\/(\d+)\/(\d+)\s+(\d+):(\d+)(\d+)/) { print $4,"\n"; } } # end if if elsif ($line =~ /invoked by root at ((\d+)\/(\d+)\/(\d+))\s+(\d+): +(\d+):(\d+)\Z/) { print $&; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need help in data processing
by davido (Cardinal) on Feb 26, 2011 at 09:06 UTC | |
|
Re: Need help in data processing
by johngg (Canon) on Feb 26, 2011 at 14:13 UTC | |
|
Re: Need help in data processing
by Anonymous Monk on Feb 26, 2011 at 08:31 UTC | |
by richardwfrancis (Beadle) on Feb 26, 2011 at 08:59 UTC | |
by achak01 (Initiate) on Feb 26, 2011 at 13:09 UTC | |
by richardwfrancis (Beadle) on Feb 27, 2011 at 06:47 UTC | |
|
Re: Need help in data processing
by umasuresh (Hermit) on Feb 26, 2011 at 13:32 UTC |