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