in reply to Logfile Summarize messages by time and export to CSV
Starting with
would probably give you a clue.use strict; use warnings;
Also adding these two statements
Would help a lot too. see http://search.cpan.org/~ishigaki/Text-CSV-1.95/lib/Text/CSV.pmuse Text::CSV; my $csv = Text::CSV->new ( { binary => 1 } ) # should set binary att +ribute. or die "Cannot use CSV: ".Text::CSV->error_diag ();
and have you considered what happens if the log has Jan 31 and Feb 1 dates in it? Gonna mess up your sort isnt it? Ive been known to use a variant of the technique used here http://cpansearch.perl.org/src/DSCHWEI/Parse-Syslog-1.10/lib/Parse/Syslog.pm to convert those kinda dates into epoch datetimes. Once its in that mode it is easy to manipulate the final output sort and style.
|
|---|