On Wed, 30 Jan 2008 21:51:56 +0100, Olaf Grüttner <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> 
> I have a question about working with sed.
> I have an xml file containing
> <theme>1</theme>
> 
> I want to change this to
> <theme>2</theme>
> 
> I have problems with the "<" and ">" signs. Is there a was to mask them
> in the sed command?
> 
> sed s/"<theme>1</theme>"/"<theme>2</theme>"/g' test.xml
> 
> does not work

You can either change the field separator from '/' to any other character, e.g. 
'@':

[EMAIL PROTECTED]:~$ cat test.xml
<theme>1</theme>
[EMAIL PROTECTED]:~$ sed -e 's@<theme>1</them>@<theme>2</theme>@g' test.xml

Or you can escape that field separator using '\':

[EMAIL PROTECTED]:~$ cat test.xml
<theme>1</theme>
[EMAIL PROTECTED]:~$ sed -e 's/<theme>1<\/them>/<theme>2<\/theme>/g' test.xml
<theme>1</theme>

Regards,

Matt.

-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to