On Tue, 17 May 2011 01:33:39 +0200, Alan McKinnon wrote:

> grep "GET /Tmp/Linux/G" | /var/log/apache2/access_log | grep-v <myip> |
> \ awk '{print $1}' | sort | uniq | wc
> 
> In true grand Unix tradition you cannot get quicker, dirtier or more
> effective than that
> 

awk does pattern matching, o you can ditch the grep stage and use

 awk '! /myip/ {print $1}'

You could use awk to search for the GET patterns too, not only saving yet
another process, but making sure that no one else, including you next
month, can work out what the command is supposed to do.

sort -u would save having a separate process for uniq, but I've no idea
if it's faster. It's only worth using sort -u if you would use uniq with
no arguments.


-- 
Neil Bothwick

- We are but packets in the internet of Life-

Attachment: signature.asc
Description: PGP signature

Reply via email to