procmail
[Top] [All Lists]

Re: Hung up while trying to scrub Yahoo advertisements...

1998-03-06 01:18:03
On Fri, 6 Mar 1998 01:09:27 -0500, Ken Hooper <bighouse(_at_)type2(_dot_)com>
wrote:
The file test.sed contains this:
     /^ *DO YOU YAHOO!?/q
The file test2.sed contains this:
     $d

Lesson one: You can give sed multiple lines of script. It's perfectly
okay to give them on the command line. If you can't figure out a good
way to do what you want, try making it the default and tell sed not to
apply it to selected lines. 

     | sed -f test.sed | sed -f test2.sed > output

So this would be something like 

        | sed -n -e '/^ *DO YOU YAHOO!?/q' -ep

But if .procmailrc contains this:
     :0
     * From:.*yahoo
     | sed -f test.sed | sed -f test2.sed
then the mail simply disappears forever. Log sez:

Yes and no, Procmail does what you asked it to do: Deliver the mail to
this sed script. The problem is that the script doesn't save the
output anywhere, it just gets written to sed's standard output which
isn't saved anywhere in particular. I'm guessing you want this:

    :0fbwi
    * ^From:.*yahoo
    | sed -n -e '/^ *DO YOU YAHOO!?/q' -ep

Pay attention to the flags. The crucial one is f, which says to take
the output of the script and use it to replace whatever went in. This
is not a delivering recipe so Procmail will continue processing, with
the body filtered, i.e. subjected to your sed script. (The b says to
only filter the body, and the i says to not panic when sed quits
early. The w tells Procmail to hang around and wait for the script to
finish. [Wouldn' you think this ought to be implied by the f already?])

/* era */

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>