in reply to Re^2: Need help in data processing
in thread Need help in data processing

Sorry! but this sol deosnt seem to work

Replies are listed 'Best First'.
Re^4: Need help in data processing
by richardwfrancis (Beadle) on Feb 27, 2011 at 06:47 UTC

    Ah I see, one of the times is on a new line. That wasn't immediately clear. Sorry. You could maybe use this although I've not tested it on a large file.

    #!/usr/bin/perl use strict; my $data = do { local $/ = undef; <DATA>; }; while ($data =~ m/Script.+\sat\s(.+)\s(\n)?(\d+:\d+:\d+)/g){ my $date = $1; my $time = $3; print "$date\t$time\n"; } __DATA__ Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/25/11 +14:36:48 blah blah blah Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/25/11 14:36:48 blah blah blah

    Cheers