procmail
[Top] [All Lists]

Re: Counting messages in a mailbox

1996-12-08 04:40:52
Timothy J. Luoma wrote:

Responding To:        Stan Ryckman <stanr(_at_)sunspot(_dot_)tiac(_dot_)net>
Original Date:        Sat, 7 Dec 1996 18:50:05 -0500 (EST)
Message-ID:   <199612072350(_dot_)SAA17775(_at_)sunspot(_dot_)tiac(_dot_)net>

egrep -i '^From ' mailbox | wc -l

why doesn't this work?  There can be only one "^From " line per  
message right?  And there has to be one for each message, doesn't  
there?

From sea to shining sea.

Did your MDA stick a character before the "From " there?  I like it
when they do, but they don't *have* to.  Assuming it didn't, then the
egrep will count this as two messages, but formail will get it right.

I use this myself for some non-critical things, so I am curious why  
this would fail

If non-critical, or if you just want an estimate, it's probably
good enough in most cases.

Another, harder, example, is when a full message is included with
all headers (including "From ") and this can only be determined by
paying attention to "Content-Length:" in the enclosing message.
Again, formail will get it right, but egrep will count too many.

Cheers,
Stan Ryckman (stanr(_at_)tiac(_dot_)net)

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