1 |
On Tue, 17 May 2011 01:33:39 +0200, Alan McKinnon wrote: |
2 |
|
3 |
> grep "GET /Tmp/Linux/G" | /var/log/apache2/access_log | grep-v <myip> | |
4 |
> \ awk '{print $1}' | sort | uniq | wc |
5 |
> |
6 |
> In true grand Unix tradition you cannot get quicker, dirtier or more |
7 |
> effective than that |
8 |
> |
9 |
|
10 |
awk does pattern matching, o you can ditch the grep stage and use |
11 |
|
12 |
awk '! /myip/ {print $1}' |
13 |
|
14 |
You could use awk to search for the GET patterns too, not only saving yet |
15 |
another process, but making sure that no one else, including you next |
16 |
month, can work out what the command is supposed to do. |
17 |
|
18 |
sort -u would save having a separate process for uniq, but I've no idea |
19 |
if it's faster. It's only worth using sort -u if you would use uniq with |
20 |
no arguments. |
21 |
|
22 |
|
23 |
-- |
24 |
Neil Bothwick |
25 |
|
26 |
- We are but packets in the internet of Life- |