Gentoo Archives: gentoo-user

From: David Haller <gentoo@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] is a nice "place" :-D
Date: Tue, 17 May 2011 15:05:48
Message-Id: 20110517143020.GA27292@grusum.endjinn.de
In Reply to: Re: [gentoo-user] is a nice "place" :-D by Alan McKinnon
1 Hello,
2
3 On Tue, 17 May 2011, Alan McKinnon wrote:
4 >grep "GET /Tmp/Linux/G" | /var/log/apache2/access_log | grep-v <myip> | \
5 >awk '{print $1}' | sort | uniq | wc
6
7 useless use of ...
8
9 awk '/GET \/Tmp\/Linux\/G/{ips[$1]++;}END{print length(ips);}' \
10 /var/log/apache2/access_log
11
12 I add each access to ips[<IP>] in case you'd want to print that to,
13 e.g. by using
14
15 END {
16 for( i in ips ) {
17 print i ":" ips[i] " accesses";
18 }
19 print length(ips) " unique IPs total";
20 }
21
22 as the "END" block.
23
24 HTH,
25 -dnh
26
27 --
28 Any research done on how to efficiently use computers has been long lost
29 in the mad rush to upgrade systems to do things that aren't needed by
30 people who don't understand what they are really supposed to do with
31 them. -- Graham Reed, in asr