procmail
[Top] [All Lists]

Re: $MATCH w/o using internal egrep

1997-06-30 17:50:00
On Sun, 29 Jun 1997 16:09:06 +0300 (EET DST),
era eriksson <era(_at_)iki(_dot_)fi> wrote:

On Sat, 28 Jun 1997 10:50:40 -0400,
"Donald E. Hammond" <deh(_at_)openix(_dot_)com> wrote:
 > I would like to use some form of the filter (which has been suggested
 > here by Philip and others) which uses formail to select which header
 > lines to search and pipes the output to fgrep for use with the bozo
 > filter.  However I would also like to log $MATCH until I'm sure it's

You can simulate this by making the fgrep (or whatever you use -- Perl
is a good candidate if you want to do something slightly more
complicated) redirect output to standard error. Anything written to
stderr will turn up in Procmail's log file (assuming of course that
you haven't turned logging off entirely). 

    :0:
    * formail -cz -xFrom -xSender: -xX-From: -xX-Sender: -xReply-to: | \
        fgrep -wsf $HOME/procmail/bozos >&2
    bozo-rejects

Off top of head; you could postprocess the output of fgrep with sed a
little bit to make clear where it comes from (i.e. sed -e 's/^/bozo: /') 
before the redirection to stderr; and, this will quite predictably
break if you're using one of the C shells and not setting
SHELL=/bin/sh.
  Still, hope this helps,

Thanks, I'll try this.  Perl probably would be a likely candidate for
something like this, but considering what you saw of how I can mangle
a procmail recipe, do you really think you want to see me try my hand
at a Perl script?  ;-)

 - Don

____________________________
 Donald E. Hammond
 deh(_at_)openix(_dot_)com  (preferred)
 deh(_at_)ripco(_dot_)com
 103750(_dot_)645(_at_)compuserve(_dot_)com

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