procmail
[Top] [All Lists]

Re: Grep first three lines of body

2001-09-06 02:40:46
From: David Cross <davidcross(_at_)bigfoot(_dot_)com>

Much email sent to our info@ address should really go to a user - gary@

I have a basic filter of:

:0Bc:
*(Dear Gary|Hi Gary|Gary,)
! gary(_at_)ourdomain(_dot_)com

Let's clean that up slightly, first.

If we were anchoring to the left of the line, this would
do the same as what you are implying above:

        * ^(Dear|Hi)? ?Gary

(It's not logical to worry about the comma only if there is
no non-eponymous salutation as the first word, but to worry
about it if the first word is eponymous.  So I've left off
the comma test altogether.)

However, you are not anchoring to the left edge of the
body, so in this case, the below would do exactly the
same as you've indicated (again, not worrying about the
comma):

        * Gary


I only want to grep the first (say)
three lines of the body for the search
strings else when Gary replies with the original message, then the
enquirer replies to Gary, we end up with mutliple copies lying around.

Ugh.  Ugh.  Ugh.

First of all, your test for replies to save should look for
a cleaner way than that.  There are, after all, ubiquitous
"Microsoft-style" followers-up, who put the original text
first, for example (horrible as that is).  One suggestion
is to look in `man procmailrc' and `man procmailex' for
tips on the use of the X-Loop header, and exclude based
on it.

As for egrepping the first three lines only of the body,
that's a slight challenge, but the below might  be an
(untested) idea.

        :0 B [other flags]:
        * ^^\/.*$.*$.*
        * MATCH ?? Gary
        ! gary(_at_)ourdomain(_dot_)com


-- 
Netcom has imploded.  Please now use NOTnetcom.com for mail.
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Ex-Netcommies:  Mail "forwards" for free forwarding service!
NOT affiliated with EarthLink, Inc.'s Netcom brand identity.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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