* get ip address lists from apache.log
authormitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Sat, 29 Oct 2011 10:36:14 +0000 (10:36 +0000)
committermitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Sat, 29 Oct 2011 10:36:14 +0000 (10:36 +0000)
git-svn-id: https://lab.mitty.jp/svn/lab/trunk@127 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

misc/addr.pl [new file with mode: 0644]

diff --git a/misc/addr.pl b/misc/addr.pl
new file mode 100644 (file)
index 0000000..7250ace
--- /dev/null
@@ -0,0 +1,20 @@
+#! /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";
+}