source: lab.git/misc/addr.pl @ 6852f37

trunk
Last change on this file since 6852f37 was 4be622f, checked in by mitty <mitty@…>, 13 years ago
  • get ip address lists from apache.log

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@127 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

  • Property mode set to 100644
File size: 321 bytes
RevLine 
[4be622f]1#! /usr/bin/perl -w
2
3use strict;
4use warnings;
5
6my $ip = '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})';
7
8my $file = shift @ARGV;
9open FILE, $file;
10
11my $addr = {};
12while (my $line = <FILE>) {
13    if ($line =~ /^$ip/o) {
14        $addr->{$1}++;
15    }
16}
17
18foreach my $key (keys %$addr) {
19    print $key, "\t", $addr->{$key}, "\n";
20}
Note: See TracBrowser for help on using the repository browser.