Hello,

On Tue, 17 May 2011, Alan McKinnon wrote:
>grep "GET /Tmp/Linux/G" | /var/log/apache2/access_log | grep-v <myip> | \
>awk '{print $1}' | sort | uniq | wc

useless use of ...

awk '/GET \/Tmp\/Linux\/G/{ips[$1]++;}END{print length(ips);}' \
    /var/log/apache2/access_log

I add each access to ips[<IP>] in case you'd want to print that to,
e.g. by using

END {
    for( i in ips ) {
        print i ":" ips[i] " accesses";
    }
    print length(ips) " unique IPs total";
}

as the "END" block.

HTH,
-dnh

-- 
Any research done on how to efficiently use computers has been long lost
in the mad rush to upgrade systems to do things that aren't needed by
people who don't understand what they are really supposed to do with
them.                                             -- Graham Reed, in asr

Reply via email to