From 4be622f7b1b38e3387d282357cb2f11598ca01d9 Mon Sep 17 00:00:00 2001 From: mitty Date: Sat, 29 Oct 2011 10:36:14 +0000 Subject: [PATCH] * get ip address lists from apache.log git-svn-id: https://lab.mitty.jp/svn/lab/trunk@127 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- misc/addr.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 misc/addr.pl 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"; +} -- 1.7.9.5