procmail
[Top] [All Lists]

Re: testing for only the subject and the body (was Re: Testing for alternate Environment variables)

1997-06-13 08:51:00
At 09:29 AM 6/13/97 +0300, era eriksson wrote:

[snip]

I almost wrote | fgrep foo | fgrep bar but unfortunately, it's not
quite that simple. (BOY do I feel stupid today. :-) If you can live
with an invocation of Perl for each message received, this should do:

   :0:
   * ? formail -k -XSubject: | \
       perl -0777 -ne 'exit 1 unless (/foo/ and /bar/)'
   folder

It can probably be coded with tr and sed or awk instead of Perl, but
don't ask me about that right now. Thank you.

FYI, here's an awk version:

    :0:
    * ? formail -k -XSubject: | \
        awk '/foo/{foo=1} /bar/{bar=1} END{exit (foo+bar!=2)}'
    folder

Cheers,
Stan

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