source:
lab.git/misc/addr.pl
@
e498534
| Last change on this file since e498534 was 4be622f, checked in by mitty <mitty@…>, 14 years ago | |
|---|---|
|
|
| File size: 321 bytes | |
| Rev | Line | |
|---|---|---|
| [4be622f] | 1 | #! /usr/bin/perl -w |
| 2 | ||
| 3 | use strict; | |
| 4 | use warnings; | |
| 5 | ||
| 6 | my $ip = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})'; | |
| 7 | ||
| 8 | my $file = shift @ARGV; | |
| 9 | open FILE, $file; | |
| 10 | ||
| 11 | my $addr = {}; | |
| 12 | while (my $line = <FILE>) { | |
| 13 | if ($line =~ /^$ip/o) { | |
| 14 | $addr->{$1}++; | |
| 15 | } | |
| 16 | } | |
| 17 | ||
| 18 | foreach my $key (keys %$addr) { | |
| 19 | print $key, "\t", $addr->{$key}, "\n"; | |
| 20 | } |
Note: See TracBrowser
for help on using the repository browser.
