procmail
[Top] [All Lists]

Re: sed question

2004-05-11 03:32:34
"Eric Wood" <eric(_at_)interplas(_dot_)com> wrote:


(Okay, you procmail guys are also the best sed guys I know - sorry of the
off topic question:)


I just found out that piping html email through newers seds (Fedora Core 1)
strips all the html:

| sed -e :a -e 's/<!--[^-]*-->//g;/</N;//ba'

Whikle with RH 7.3, the older sed works properly and doesn't eat up the
html.


Luckily, If found this rule which works on new *and* old version of sed:

# Strips out all HTML comments, sed -f
/<!--/!b
:a
/-->/!{
       N
       ba
}
s/<!--.*-->//


My problem is that I'd rather have it on one line again.  And sed wizards
reading this?


sed -e '/<!--/!b' -e :a -e '/-->/!{N;ba' -e '};s/<!--.*-->//'

is some words, you can join lines using ; but you have to break your one liner
on branches (b) and labels (:). say, you can't -e 'b;a:;etc.' but you can -e b
-e :a -e etc.

Cyrille Lefevre.
-- 
home: mailto:cyrille(_dot_)lefevre(_at_)laposte(_dot_)net


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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