POV-Ray : Newsgroups : povray.off-topic : sed question : Re: sed question Server Time
6 Sep 2024 17:20:20 EDT (-0400)
  Re: sed question  
From: triple r
Date: 17 Nov 2008 11:00:01
Message: <web.4921949ae31b5110866b6f750@news.povray.org>
"Jim Holsenback" <jho### [at] hotmailcom> 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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.