Home » Infrastructure » Unix » To insert string after a search parameter (unix- hp )
icon4.gif  To insert string after a search parameter [message #445737] Wed, 03 March 2010 12:51 Go to next message
Messages: 10
Registered: March 2010
Location: bangalore
Junior Member
hi all,

i need to write a shell script which takes a file name as input, and insert the contents of that file after a search parameter in anothr file...

for e.g.,
my input file id in.xml.. it contains,
<some element>
</some element>

i have another file say, file.xml...
it has,
<id>"some data"</id>
<name>"some data"</name>

i need to insert the file content of in.xml(<root><some element</some element></root>) in between <content> and </content>, and place the output in a new file say, new.xml...

in my shell script "in.xml" is the input i.e ($1)
how to extract the content of it and place it in between <content> and </content> tags of file.xml...

Pls some one help me in this.....
Re: To insert string after a search parameter [message #445739 is a reply to message #445737] Wed, 03 March 2010 13:06 Go to previous message
Mahesh Rajendran
Messages: 10694
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
What happens if there are multiple child elements?
If there are multiple <someElement></someElement> where would it be inserted into?
An XSL solution is ideal. But it is out of the scope of this forum.
Please post in an appropriate forum to get better response.
Previous Topic: copy file from unix system to sharepoint
Next Topic: Oracle verison 10g Client for Solaris 32 bit
Goto Forum:

Current Time: Mon Sep 27 09:22:19 CDT 2021