I'm looking for caveats, tips'n'tricks etc. for awk. For example:
awk '$9=="404"{a[$7]++}END{for(i in a)print a[i],i}' access.log|less
this code, will print errors aggregated by page path.
There is a trick, to sort an array by setting WHINY_USERS to any, nonzero value, to automatically use isort function on array before printing:
WHINY_USERS=1 awk '$9=="404"{a[$7]++}END{for(i in a)print a[i],i}' access.log|less
This code will return same errors but sorted by the key name (path).
I'm looking for more tricks like this one - do you know any resource which has them listed? could you share best tricks you know? I've never found awk wiki - only same old tuts repeated over and over...