How do I count the messages of Postfix's mailq?

How can I get number of messages count in Postfix's mailq? mailq command display entire mails in mailq but i would like to know count only.Is there any command for this. My OS is centos 5.5.


I use this:

mailq | grep -c "^[A-F0-9]"

You can pipe the output of mailq through various other filters such as uniq, sort and wc to get other statistics.


either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l

both works