1 |
On 2011/05/17 01:33 (GMT+0200) Alan McKinnon composed: |
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 effective |
7 |
> than that |
8 |
|
9 |
It almost worked too. :-) |
10 |
|
11 |
grep "GET /Tmp/Linux/G" /var/log/apache2/access_log | grep -v <myip> | \ |
12 |
awk '{print $1}' | sort | uniq | wc -l |
13 |
|
14 |
got me almost what I wanted, 20 unique IPs, but that's a lot of stuff to |
15 |
remember, which for me will never happen. So I tried converting to an alias. |
16 |
|
17 |
grep "GET $1" | /var/log/apache2/access_log | grep -v <myip> | \ |
18 |
awk '{print $1}' | sort | uniq | wc -l |
19 |
|
20 |
sort of works, except I won't always be looking for GET as part of what to |
21 |
grep for, or might require more than one whitepsace instance, and am tripping |
22 |
over how to deal with the whitespace if I leave GET out of the alias and only |
23 |
put on cmdline if I actually want it as part of what to grep for. |
24 |
|
25 |
grep "GET $1 $2" | /var/log/apache2/access_log | grep -v <myip> | \ |
26 |
awk '{print $1}' | sort | uniq | wc -l |
27 |
|
28 |
seems to work, but I'm not sure there aren't booby traps besides 2nd or more |
29 |
whitespace instances I'm not considering, even though it gets the same answer |
30 |
for this particular case. |
31 |
-- |
32 |
"The wise are known for their understanding, and pleasant |
33 |
words are persuasive." Proverbs 16:21 (New Living Translation) |
34 |
|
35 |
Team OS/2 ** Reg. Linux User #211409 ** a11y rocks! |
36 |
|
37 |
Felix Miata *** http://fm.no-ip.com/ |