procmail
[Top] [All Lists]

Re: what regexps work?

1997-04-10 21:23:00
At 09:34 PM 4/10/97 -0400, you wrote:
On Thu, 10 Apr 1997 14:10:05 -0700 (PDT) bodysurf(_at_)netcom(_dot_)com (Tim)
wrote:

     * ? echo "`formail -rtxz'To:'`" | egrep -i -f $HOME/friends
     $DEFAULT

The recipe is fairly self-explanatory.

Take a close look at that echo statement:

 echo "`formail -rtxz'To:'`"

Think about what you're doing there -- you're running a program that
produces some text on its standard output.  You're using backquote
expansion to place this value in an echo statement -- which just spits
its arguments to standard output.

Try this:

* ? formail -rtzx "To:" | egrep -i -f $HOME/friends

Within my procmail environment, the variable FROM is always defined, so
the following reduces the number of program executions by another one:

* FROM ?? ? egrep -i -f $HOME/friends

Here's the way I really do it:

        PMDIR=$HOME/Procmail
        PMDIRp=$PMDIR/Private
        EGREP=$HOME/Bin/grep
        FORMAIL=/usr/local/nuglops/bin/formail
        FRIENDS=$PMDIRp/friends
        FROM=`$FORMAIL -rt -x'To:'`

        #
        # Check to see if this email is from a "friend".  If so, stick it in my
        #
        # INBOX.
        #
        :0
        * ? echo "$FROM" | $EGREP -i -f $FRIENDS
        $DEFAULT

What I just did to make the recipe easier to follow is replace the
variables with the actual way I define them to make it easier to follow.

Lates!
---------------------------------------------------------------------------
Tim <bodysurf(_at_)pobox(_dot_)com>                          
mailto:bodysurf(_at_)pobox(_dot_)com
Finger bodysurf(_at_)pobox(_dot_)com for my PGP public key (Bits 1024/KeyID 
09DA5C49).
PGP Key FPrint (09/03/94): 4C 97 F1 FA 70 55 68 91  49 D1 AD F2 DD 63 0C 15
---------------------> Please PGP encrypt your email <---------------------

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