How do I search, sort & count log file content?

Hi,
I have email log files, which I would like to be able to extract multiple email address in a given column ( awk '{print $12}' ) & a count of the total number of occurrences for each. Essentially a top ten (or top 100) list. Any advice would be great.
Thanks.
buster2007Asked:
Who is Participating?
 
ozoCommented:
if you want the top 10 counts
awk '{print $12}' file | sort | uniq -c | sort -nr | head
0
 
omarfaridCommented:
you can do

awk '{print $12}' file | sort | uniq -c
0
 
buster2007Author Commented:
That's exactly what I was looking for, perfect, thank you very much!
0
 
woolmilkporcCommented:

... and to have only a 'top ten' list, use
 
awk '{print $12}' file | sort | uniq -c | head -10
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.