[Linux-Biella] script....

Claudio linux@bilug.linux.it
Thu, 29 May 2003 16:49:39 +0200


Il Thu, 29 May 2003 16:38:26 +0200
"CIARROCCHI Paolo" <Paolo.CIARROCCHI@vodafone.com> scrisse:

CP> Se e quando hai tempo, nessuna fretta.
CP> No problem e grazie!

Ok, fatto e testato


#!/usr/bin/perl

open IN, "< dati.txt";

while (<IN>) {
        chop;
        /(\S+\s\S+)\s+(\w+)/;
        $data = $1;
        $numero = $2;
        if (exists $listagiorni{$data}) {
                $listagiorni{$data} = $listagiorni{$data} + $numero;
        }
        else {
                $listagiorni{$data} = $numero;
        }
}

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

Bye

-- 
Per cortesia niente allegati word, solo in formato ASCII (.txt) 
oppure Rich Text Format (.rtf)
--
Linux Registered User     #151147  |  Home Page    http://www.bilug.linux.it
Linux registered Machine  #66331   |  ICQ Number   53293810
GPG key http://claudio.bmm.it/gpg/key-bilug.asc