procmail
[Top] [All Lists]

Re: Counting messages in a mailbox

1996-12-09 15:53:00
Stan Ryckman wrote,

| This seems to work:
|       formail -s formail -X 'From ' < mailbox | wc -l
| but due to the number of processes, it's *very* slow.

You don't need the extra formail for each message, as Alan Stebbens has
posted.

 formail -X'From ' -s < mailbox | wc -l

will run much faster.  Stephen van den Berg has suggested this, and it may be
faster yet because it feeds less text to wc:

  formail -I'From x' -zx'From ' < mailbox | wc -l # or | wc -w

And, unlike grep -c '^From ', it won't be fooled by occurrences of "^From "
in the body that are protected by a Content-Length: header.

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