procmail
[Top] [All Lists]

Re: Email Counting!

1998-11-30 20:17:35
Justin Lloyd <jlloyd(_at_)harris(_dot_)com> writes:
This is very silly, but how about

  cat /path/to/mailbox | formail -s echo | wc -l

Ouch, that's a fork/exec per message!  Try the following instead:

        formail -I"From x" -x"From " -s <mailbox | wc -l

No per-message forking and only two bytes are fed to wc for each
message.  Now, if you _know_ that the mailbox does not use the
Content-Length: header to protect embedded "From " lines the the
fastest should probably simply be:

        grep -c '^From ' mailbox


Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Email Counting!, Philip Guenther <=