"L" == Liviu Daia <Liviu(_dot_)Daia(_at_)imar(_dot_)ro> writes:
L> For the reason I stated above, you can't do it with procmail
L> alone. There's no reason to spawn two copies of sed though.
You're right, no need for two copies of sed.
L> Let's see. It doesn't work because, unlike your first example, in
L> real life the "]" can be preceded by a space (or "(fwd)" can be followed
L> by a space). Ok, try this:
L> echo "[Fwd: [Fwd: Re: [ace-users] misc.jet] (fwd) ] (fwd)" | sed \
L> -e 's/^\(\(\[Fwd\|Re\):[ ]*\)*//' \
L> -e 's/\([ ]*\][ ]*\|[ ]*(fwd)[ ]*\)*$//'
Is it that my sed works different than yours?
+ echo [Fwd: [Fwd: Re: [ace-users] misc.jet] (fwd) ] (fwd)
+ sed -e s/^\(\(\[Fwd\|Re\):[ ]*\)*// -e s/\([ ]*\][ ]*\|[
]*(fwd)[ ]*\)*$//
[Fwd: [Fwd: Re: [ace-users] misc.jet] (fwd) ] (fwd)
Note, the output on the last line is absolutely the same as input.
Thanks again.
Tony