procmail
[Top] [All Lists]

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

1998-03-07 00:04:00
era eriksson wrote (along with Jari and Ken): about using sed to
cut out an advertising blurb

  Here's a modified version of something I found on the web.  It
apparently does the hacking+slashing without any external calls.
I'm still trying to figure out the logic behind it.  Hopefully
you guys can.  I haven't seen this many special characters in
so few lines since the "bad ole days" before error-correcting
modems<g>.

# I added the recipie before the first set of braces quickly.
# Check carefully here.  The entire message is imported, so
# allow for a megabyte.  Bail out if too big or does not
# contain the offending string.  Is this "non-delivering"?
DELETE_STRING="DO YOU YAHOO!"
LINEBUF=1000000
:0
$ < $LINEBUF
$ $DELETE_STRING
{
:0            # grab everything to the left of DELETE_STRING
* $ AFTER ?? ^\\/([^$DELETE_STRING]+)?
{ BEFORE = $MATCH }

:0            # grab everything to the right of DELETE_STRING
* $ AFTER ?? ^([^$DELETE_STRING]+)?[$DELETE_STRING]\\/.*\$
{ AFTER = $MATCH }

NEW_MESSAGE = ${BEFORE}$AFTER

# Now I'm lost. How do we feed the contents of NEW_MESSAGE
# and overwrite the old message body?
}

-- 
Walter Dnes (Toronto)
<waltdnes(_at_)interlog(_dot_)com>