On Wed, 8 Oct 2003, Dallman Ross wrote:
: On Wed, Oct 08, 2003 at 03:13:26PM -0500, Robert A. Hayden wrote:
: >
: > grep "^From: " /var/spool/mail/rhayden | wc -l
:
: Not all that hot, Robert, if a good try. For one thing, there's
: no need for grep piped to wc. You can use the -c option with
: grep:
:
: COUNT = `grep -c '^From:' $MAIL`
:
: (Note that I took your space out. There is no RFC requirement for a
: space, and it also could be a tab.) But as you state, it's easy to fool
: that test.
If you're trying to count messages in a file in mbox format, the regex
for the message delimiter should be "^From ". This is not the same as the
"From:" header usually displayed by MUAs. Note that this may also subject
to error if your LDA does not do "^From " escaping in message bodies -- see
the part about explicit delivery in the MISCELLANEOUS section of the procmail
man page.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail