in reply to search and give the time difference
I agree with marto, though here's a few hints to get you started.
use strict; use warnings; my @starting = (); my @success = (); my @linetypes = ("Starting", "SUCCESS: Completed"); my $linetypes_re = join("|", @linetypes); my @lines = getAllLinesFromTheBigLogFile__ILeaveItAsAnExerciseToYouToD +oThat(); for my $line (@lines) { chomp $line; # makes life so much easier. next unless $line; my ($linetype, $module, $year, $month, $day, $hh, $mm) = $line =~ +m/^($linetypes_re) (.+$) at (\d{4})-(\d{2})-(\d{2})-(\d{2})(\d{2})\.$ +/ my $info = [$module, $year, $month, $day, $hh, $mm]; if ($linetype eq $linetypes[0]) { push @starting, $info; } elsif ($linetype eq $linetypes[1]) { push @succes, $info; } }
Beware: code is incomplete and untested and might be full of typos, bugs, logical flaws and other oddities. It's just supposed to get you on the right track.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: search and give the time difference
by raghvens (Novice) on Sep 09, 2011 at 14:05 UTC |