"Jim Holsenback" <jho### [at] hotmail com> wrote:
> This sample line example shows what I need to do:
>
> <indexentry "This part is always different>
Should there be a quote at the end of that? I'll assume so.
> needs to look like this:
>
> <!-- <indexentry "This part is always different"> -->
> sed s\%'<indexentry*'%'<!-- <indexentry* -->'%g test.html
I think the problem is that you need to use \( \) and a \1 to correctly extract
that portion of the text. I have success with:
sed -e 's%<indexentry "\([^"]*\)">%<!-- <indexentry "\1"> -->%g'
To break that down, [^"]* finds everything up until the final quote, and the \(
\) around that lets you reference that later with \1. Then just type the
expression as you would like it to appear, with the \1 in place of the text.
Hope that helps.
- Ricky
Post a reply to this message
|