source: lab/trunk/misc/addr.pl @ 127

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