...

View Full Version : Extracting info from files



soper87
07-21-2009, 10:29 AM
I have a log file viewer which has lines displaying UTC time as:
time[000000000.000]

I want to to pull this in from the file, using a search mechanism, and store the numerical value from the line. This will then allow me to use the variable holding the time to allow the user to convert the time format displayed when the click on the Convert Time button. What would be the quickest/easiest way to do this?

Cheers
Chris

FishMonger
07-21-2009, 02:04 PM
$_ = 'time[000000000.000]';

my ($timestamp) = $_ =~ /time\[([\d.]+)\]/;
print $timestamp;

soper87
07-23-2009, 09:44 AM
thanks, seems to work ok

Chris



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum