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
>> exactly trivial. I don't know if this is the best solution, but it
>> seems to work:
> Scoring is a great tool, but beware the hammer/nail syndrome.
> How about (warning, my syntax is probably wrong)
> :0
> * To: \/.*
> * ? echo $MATCH | wc -w > 5
era eriksson <era(_at_)iki(_dot_)fi> will count as three words.
If you're calling up an external shell to do things anyway, why not
just do formail -rtzxFrom: instead of the match-and-echo-MATCH
maneuver?
And yes, the syntax is wrong. I don't know if it's possible to do
what you envision -- doesn't VAR ?? > n merely check whether $VAR is
longer than n bytes?
How about something like this:
:0
* ^To: \/.*
{COMMA=`echo $MATCH| grep -c ,`}
:0
* ? test $COMMA -gt 5
{whatever action you want}
--
He who attacks the fundamentals of the American broadcasting industry
attacks democracy itself.
-- William S. Paley, chairman of CBS