#! /usr/bin/perl -w

use strict;
use warnings;

my $ip = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})';

my $file = shift @ARGV;
open FILE, $file;

my $addr = {};
while (my $line = <FILE>) {
    if ($line =~ /^$ip/o) {
        $addr->{$1}++;
    }
}

foreach my $key (keys %$addr) {
    print $key, "\t", $addr->{$key}, "\n";
}
