procmail
[Top] [All Lists]

Re: counting msgs in mbox

2003-10-08 13:15:55
I've found the following good in giving me a fairly accurate count:

grep "^From: " /var/spool/mail/rhayden | wc -l

It's not 100% accurate.  if people forward you an email it can show up as 
two messages, but it's pretty accurate.

On Wed, 8 Oct 2003, Jim Osborn wrote:

I need to know how many individual mails are in an mbox mail folder.
I don't know of any way to get the count directly from formail or
procmail, so it's on to formail -s <something> <mbox-to-count.
My question is: what's the most efficient <something>?

My current favorite is: 

cat /dev/null >tempfile
formail -s echo blah >>tempfile <mbox-to-count
COUNT="`wc -l <tempfile`"
rm -f tempfile

This seems cleaner than saving a count in a file, reading it,
incrementing it, and resaving it.  But I suspect better minds than
mine might have a simpler solution. 

I'm using procmail 3.22.

TIA,

Jim

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>