procmail
[Top] [All Lists]

Re: Message count

1999-03-25 08:04:13
Tim Walberg wrote,

| Not 100% bullet proof, but try
|   cat ${MAILFILE} | grep '^From ' | wc -l

If you use that method, it can be done in one process rather than three:

   grep -c '^From ' ${MAILFILE}

The braces are optional but harmless.

That it can be done in only one process is the only reason for using that
shortcut.  If you're going to use multiple processes, this is closer to being
100% bullet-proof:

  formail -s echo < $MAILFILE | wc -l
or
  FILENO=1 formail -s printenv FILENO < $MAILFILE | tail -1

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