Getting Unique Counts From a Log File
blog.hypergeometric.com
blog.hypergeometric.com
ie..
cat file | grep bar | awk '{ print $1 }' | sort | uniq
which can simply be awk '/bar/ { print $1 | "sort -u"}' fileThat being said, point well made.
cat file | less
and then cat file | grep bar | less
and then cat file | grep bar | awk '{ print $1 }' | less
and so on.But if it's going to be used more than once then it does seem odd to have the unnecessary commands. Maybe "advanced" awk (beyond print $1) is unknown to people?
cat some.log | awk '/regexp/ { print $2}' | sort| uniq
Then tweak that line to get what I want, then change it to: zcat some.log*| ...http://en.wikibooks.org/wiki/Ad_Hoc_Data_Analysis_From_The_U...