maybe this script may help:

use strict;
use warnings;

my %data;
while ( defined ( my $line = readline ) )  {
    chomp $line;
    my ($date, $num) = split(/,/, $line);
    push(@{$data{$date}}, $num);
}

foreach my $date (sort keys %data) {
    print join(',', $date, @{$data{$date}}), "\n";
}

perl script.pl *.txt

On Mon, Feb 14, 2011 at 11:46, Muzammil <muzammil....@gmail.com> wrote:

> file 1
> 2010-11-21,2
> 2010-12-01,1
>
> file 2
> 2010-11-22,12
> 2010-12-01,11
>
> this is for GD graph and the file file should be like this
> 2010-11-21,2
> 2010-11-22,12
> 2010-12-01,1,11
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>


-- 
Marcos Rebelo
http://www.oleber.com/
Milan Perl Mongers leader https://sites.google.com/site/milanperlmongers/
Webmaster of http://perl5notebook.oleber.com

Reply via email to