procmail
[Top] [All Lists]

Re: Matching # of recipients in To:?

1997-08-05 09:43:00
Wotan <wotan(_at_)netcom(_dot_)com> wrote:
X-Loop: The Lunatic Fringe

Hmmm.

On Mon, 4 Aug 1997, era eriksson wrote:
On Mon, 4 Aug 1997 10:58:24 -0500, 
wwgrol(_at_)sparc01(_dot_)fw(_dot_)hac(_dot_)com (W.
Wesley Groleau x4923) wrote:
 Is anyone aware of a way to filter (in Procmail) based upon number
of addresses in these fields or would I have to filter it through
a perl script?
You can use scoring to accomplish this (man procmailsc) but it's not
Scoring is a great tool, but beware the hammer/nail syndrome.
How about something like this:
:0
* ^To: \/.*
{COMMA=`echo $MATCH| grep -c ,`}

Will count matching lines. Still the problem of CC'ed, etc addresses.

:0
* ? test $COMMA -gt 5

:0
* $ $COMMA^1
* -5^1
{ action(s) }

I'd like this to work, but it doesn't:

        * $ `egrep ^TO | sed 's/^[A-Za-z][^:]*:/,/' | tr -cd , | wc -c`^0

So how about this:

        :0
        * $ `egrep '(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|\
                Apparently(-Resent)?)-To):(.*[^a-zA-Z])?)'| sed \
                's/^[A-Za-z][^:]*:/,/' | tr -cd , | wc -c`^0
        * -5^1
        { action(s) }

Elijah
------
I /dev/null dupes, no need to CC list posts.  It is not my responsibility to
prove to you my mail is not spam, if mail to you bounces it will not be resent.