Get a count of top 10 emails that are in mail queue

Below one liner, pipes mailq command to sed, which prints out every 3rd line starting from line 5 capturing only the email addresses and producing report of the top 10 email addresses in sendmail mail queue.

mailq | sed -n '5~3p' | sort  | uniq -c | sort -nr | head

Comment