Link to home
Start Free TrialLog in
Avatar of buster2007
buster2007

asked on

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.
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

you can do

awk '{print $12}' file | sort | uniq -c
Avatar of buster2007
buster2007

ASKER

That's exactly what I was looking for, perfect, thank you very much!

... and to have only a 'top ten' list, use
 
awk '{print $12}' file | sort | uniq -c | head -10
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial