# Script to go through file and count the number of # times an ip appears; use strict; use warnings; my $file = 'd:\temp\text.csv'; my %hash; open (FILE, $file) or die "Can't open $file: $!\n"; while (<FILE>){ my($src) = (split /,/)[1]; $hash{$src}++; } foreach my $ip (sort({$hash{$b} <=> $hash{$a}} keys %hash)) { print "$ip appears $hash{$ip} times\n"; }
In reply to Re: Re: Counting the Number of Times and IP Appears
by Dru
in thread Counting the Number of Times and IP Appears
by Dru
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |