Harold Castro <[EMAIL PROTECTED]> wrote:
> I'm parsing a log file that contains this format:
>
> 1112677214 31388202 181264589
> 1112677214 8843 59460 8843 59460
> 1112676919 10728 59045 10728 59045
> 1112676900 10617 59006 10728 59045
> 1112676600 8693 58389 9531 59661
>
> These logs are in unix timestamp format:
> I'm trying to convert the first column into scalar localtime.
Why not do it the simple way:
while( <FILE> ){
s/^(\d+)/scalar localtime( $1 )/e;
print;
}
or even simpler on the command line:
perl -pne 's/^(\d+)/scalar localtime( $1 )/e'
HTH,
Thomas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>