Here's my stab at it:

#!/usr/bin/perl -w

use strict;

my %info;

open INFILE, "$ARGV[0]" or die "Can't open file: $!\n"; # Open file specified on 
command line
while (<INFILE>) {
    chomp;
    my ($date, @data)=split;          # Capture the date, then the rest
    $date=~s/_\d{4}$//;               # Remove the timestamp, since we're summarizing 
the day
    for (my $i=0; $i<=$#data; $i++) { # Add data to the appropriate column
        $info{$date}[$i]+=$data[$i];  # per date!
    }
}
close INFILE;

foreach my $date (sort keys %info) {           # Print the results by sorted date
    print "$date";
    for (my $i=0; $i<$#{$info{$date}}; $i++) { # Column by column
        print " $info{$date}[$i]";
    }
    print "\n";
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to