procmail
[Top] [All Lists]

Re: Searchhing for words in external word list?

2008-12-11 05:48:30
On (10:02 11/12/08), Dave Wood <dave(_at_)unrealize(_dot_)co(_dot_)uk> put 
forth the proposition:
On (09:35 11/12/08), Dave Wood <dave(_at_)unrealize(_dot_)co(_dot_)uk> put 
forth the proposition:
I would like to know if it's possible to search for words contained in an
external file. Something like:

BADWORDS=`cat $HOME/.badwords`

:0
* ^Subject:.*${BADWORDS}*
spam

This doesn't work and I'm guesing that it's looking for a match of all the
output of cat rather than checking each word.

Solved I think. I separated each word with | so my word file looks like
word1|word2|word3 Then used [ ] in the test:

:0
* ^Subject:.*[${BADWORDS}]*
spam

Seems to work now but need more testing.

Well I messed this up. I know now that [ ]  means excluding. But changing
the test to

* ^Subject:.*${BADWORDS}*

doesn't seem to work. Am I right in thinking that procmail is treating the
 | characters as part of the search string rather than an operator?



This is the idea anyway. If anyone has some suggestions on how to do it
that would be great.

Cheers

-- 
How doth the little crocodile
    Improve his shining tail,
And pour the waters of the Nile
    On every golden scale!

How cheerfully he seems to grin,
    How neatly spreads his claws,
And welcomes little fishes in,
    With gently smiling jaws!
            -- Lewis Carrol, "Alice in Wonderland"

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

-- 
Remember:  Silly is a state of Mind, Stupid is a way of Life.
              -- Dave Butler

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

-- 
Anyone who is capable of getting themselves made President should on no
account be allowed to do the job.
                -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail