From: mitty Date: Sat, 29 Oct 2011 10:36:14 +0000 (+0000) Subject: * get ip address lists from apache.log X-Git-Url: http://lab.mitty.jp/git/?p=lab.git;a=commitdiff_plain;h=4be622f7b1b38e3387d282357cb2f11598ca01d9 * get ip address lists from apache.log git-svn-id: https://lab.mitty.jp/svn/lab/trunk@127 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- diff --git a/misc/addr.pl b/misc/addr.pl new file mode 100644 index 0000000..7250ace --- /dev/null +++ b/misc/addr.pl @@ -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 = ) { + if ($line =~ /^$ip/o) { + $addr->{$1}++; + } +} + +foreach my $key (keys %$addr) { + print $key, "\t", $addr->{$key}, "\n"; +}