On Dec 11, 5:11pm, David W. Tamkin wrote:
Subject: Re: formail -D generates empty msg. when duplicate found?
I just sent a private reply to Gary, not noticing that he'd also posted.
| Hmmm, ok, but I don't see the benefit of sending through the bogus
| message, and the manpage seems to indicate otherwise:
| I'd read "not output a duplicate message" as meaning "nothing
| will be sent to the output".
But the program after -s is still invoked with the null output as its input.
I have the feeling that formail's -D and -s options were not designed to work
together, and any degree to which they do is lagniappe if not serendipity.
definitely 'lagniappe' - had to look that one up. :)
Still, I think that isn't a great justification for the current behavior.
'Split mode' really should deliver well-formed messages, not empty ones,
in my opinion.
| The problem with sending something through is that it will
| confuse simple scripts like this:
|
| formail -D 10000 id.cache -s echo . < mbox | wc -l
|
| which attempts to count the number of unique messages, but
| will actually count all messages, due to the dummy 'From '
| being passed through.
It's not the dummy From_; there is none, I've come to believe, and that the
dummy postmarks you saw were actually generated by procmail when it saved the
null messages to mboxes without the `r' flag on the recipe.
Makes sense. It's a null (zero length) message being passed into procmail.
The problem is
that, even if the message is a duplicate and there is no output, formail -s
still invokes echo.
Right. And it shouldn't :).
This would get around that, albeit inelegantly:
formail -D 10000 id.cache -s < mbox | formail -s echo . | wc -l
or this with somewhat more efficiency, though it's uglier to type, based on a
suggestion from Stephen van den Berg in a similar thread years ago:
formail -D 10000 id.cache -I'From x' -x'From ' -s < mbox | wc -l
eye yie yie. :) Hate to ask, but how does this work? The first -I
ensures there's a From on each message, and the -x extracts its value
('x'), right? Won't this count all messages? Or is the -s call
suppressed by the presences of -I?