[Linux-Biella] script....

Claudio linux@bilug.linux.it
Thu, 29 May 2003 15:41:03 +0200


Il Thu, 29 May 2003 15:28:57 +0200
"CIARROCCHI Paolo" <Paolo.CIARROCCHI@vodafone.com> scrisse:

CP> vuoi che te lo mandi in pvt ?

non e' il caso
Se il formato e' quello che mi hai indicato prima puoi fare una cosa del genere:

open IN, "< iltuofile";

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

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

Ad occhio dovrebbe essere corretto, on sono sicurissimo sull'expr regolare, luca che ne dici?

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