procmail
[Top] [All Lists]

Re: counting msgs in mbox

2003-10-08 13:31:06
On Wed, Oct 08, 2003 at 03:13:26PM -0500, Robert A. Hayden wrote:
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.

I use the mbox 'From ' marker:

    egrep '^From ' mbox | wc -l

Most MTAs will change lines beginning with 'From ' in the body of the
message to '>From ' so that the MTA doesn't get confused. This has
always worked with my setup, but won't work for MTAs that don't
correctly do mbox format. Counting "From:" lines is likely not to work
all the time for reasons you've already stated; "From:" is not
important to distinguish messages in mbox format while "From " is.

Scott
-- 
Scott Wiersdorf
scott(_at_)perlcode(_dot_)org

_______________________________________________
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>