It doesn't fail or error or anything... it just doesn't sort properly. When I grep TIMESTAMP out of my output file, the last dozen-ish lines look like this:my $log = $provoutfile; print "Now Processing $log....\n"; open LOG, "$log" or die "LOG $log: $!\n"; $linecnt = 0; while (<LOG>) { chomp $_; $linecnt++; my @sortedlines = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [$_, Time::Piece->strptime($_, '%a %b %d %H:%M:%S %Y')-> +epoch ] } @lines; $line = ""; $linecnt = 0; }
Maybe it's because each individual log entry is broken up by newlines?TIMESTAMP=Fri Nov 2 16:33:18 2018 TIMESTAMP=Fri Nov 2 17:26:35 2018 TIMESTAMP=Fri Nov 2 17:26:35 2018 TIMESTAMP=Fri Nov 2 17:27:33 2018 TIMESTAMP=Fri Nov 2 17:27:33 2018 TIMESTAMP=Thu Oct 18 18:29:15 2018 TIMESTAMP=Thu Oct 18 18:29:15 2018 TIMESTAMP=Thu Oct 18 18:29:27 2018 TIMESTAMP=Thu Oct 18 18:29:27 2018 TIMESTAMP=Thu Oct 18 19:06:32 2018 TIMESTAMP=Thu Oct 18 19:06:32 2018
In reply to Re: Merge 2 or more logs, sort by date & time
by ImJustAFriend
in thread Merge 2 or more logs, sort by date & time
by ImJustAFriend
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |