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



SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remove html tags with bash dejavu88 Shell Programming and Scripting 4 05-22-2008 01:58 PM
How to supplement HTML tags with SED DocBrewer Shell Programming and Scripting 3 04-25-2008 09:40 AM
removing html tags via parameter expansion rev66 Shell Programming and Scripting 2 03-14-2008 12:26 PM
html tags dunryc Shell Programming and Scripting 3 11-29-2007 06:14 PM
unsing sed to strip html tags - help zap Shell Programming and Scripting 3 04-18-2004 04:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-17-2005
nem_kirk nem_kirk is offline
Registered User
  
 

Join Date: Nov 2005
Posts: 1
Automated replacement of HTML Tags

Hi All,

I use a utility to generate a xml file....which looks something as follows

<xml>
<name>some name</name>
<value>some value</value>
<machine>rocker</machine>
</xml>

I would like to run a KSH script which will replace this machine tag value 'rocker' to say 'docker'.
I would like to pass a text file with these replacement variables to this original xml file to the Unix script and replace all occurences of the machine tag in the file with the values inside the text file.


Thanks for your help in advance
ciao.
  #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
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:09 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0