[Linux-Biella] script....

CIARROCCHI Paolo linux@bilug.linux.it
Thu, 29 May 2003 15:57:09 +0200


From: Claudio [mailto:cmaffio@bilug.linux.it]
> Ad occhio dovrebbe essere corretto, on sono sicurissimo=20
> sull'expr regolare, luca che ne dici?

$ cat prova.pl
open IN, "< xxxx.txt";

while (<IN>) {
        ($data, $numero) =3D~ /(\d{2}-\w{3}-\d{4} \d{2}:\d{2})\s+(\w+)/;
        if (exists $listagiorni{$data}) {
                $listagiorni{$data} =3D $listagiorni{$data} + $numero;
        }
        else {
                $listagiorni{$data} =3D $numero;
        }
}

while (($key,$value) =3D each %listagiorni) {
        print "$key : $value;\n";
}


$ perl prova.pl
 : 0;


$ head -10 xxxx.txt
27-may-2003 20:00                    2
27-may-2003 20:00                    1
27-may-2003 20:00                    1
27-may-2003 20:01                    1
27-may-2003 20:02                    2
27-may-2003 20:02                    1
27-may-2003 20:02                    1
27-may-2003 20:02                    1
27-may-2003 20:03                    1
27-may-2003 20:03                    1

Doh...


			Paolo