The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > SUN Solaris
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 11-17-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
  
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
This is a verbose way of doing it but it ensures that any replacements are exact as intended....
Code:
$ sed 's!\(<machine>\)rocker\(</machine>\)!\1docker\2!' foo.xml
<xml>
<name>some name</name>
<value>some value</value>
<machine>docker</machine>
<name>some name</name>
<value>some value</value>
<machine>docker</machine>
</xml>
Cheers
ZB