
kaminsky at math
Sep 12, 2004, 12:22 PM
Post #2 of 2
(44 views)
Permalink
|
* Salvador Blasco Llopis <salblas [at] alumni> [12/09/04 16:54]: > Hi all: > I wanted to write a procmail recipe to erase the MSN > advertisements at the end of the emails coming from hotmail. You know > what i'm talking about, don't you? Well, i tried this: > > :0 fw > * ^From.*(hotmail|msn)\.com > | sed -e 's/^\_{65}$(^.*$){2}/Annoying advertisement removed/' > > But it does nothing. What is wrong with it? Is there a better > solution? As you can see it should replace a single line with 65 underscores > followed by two lines but it does nothing. Any idea? My sed is a bit rusty, but AFAIK, sed works linewise: the substitution is performed on each line; and the $ stands for the end of line. If you are willing to use perl instead of sed, a similar solution is: | perl -O0777 -pe 's/^_{65}$(.*?$){2}/Annoying advertisement removed/mgo' (untested). The -O0777 causes the whole input to be passed as one line. The m option to the substitution operator tells perl to interpret the $ as new line rather than end of string. HTH, Moshe > > Thanks in advance. -- I love deadlines. I like the whooshing sound they make as they fly by. -- Douglas Adams Moshe Kaminsky <kaminsky [at] math>
|