Sponsored Content
Top Forums Shell Programming and Scripting Read xml tags and then remove the tag using shell script Post 302989751 by RJG on Wednesday 18th of January 2017 01:53:12 AM
Old 01-18-2017
Read xml tags and then remove the tag using shell script

Code:
<Start>
<Header>
This is header section
</Header>
<Body>
<Body_start>
This is body section
<a>
<b>
<c>
<st>111</st>
</c>
<d>
<st>blank</st>
</d>
</b>
</a>
</Body_start>
<Body_section>
This is body section
<a>
<b>
<c>
<st>5</st>
</c>
<d>
<st>666</st>
</d>
</b>
<b>
<c>
<st>154</st>
</c>
<d>
<st>1457954</st>
</d>
</b>
<b>
<c>
<st>845034</st>
</c>
<d>
<st>blank</st>
</d>
</b>
</a>
</Body_section>
</body>
</start>

If 'st' value of 'c' tag is 154 , then the whole <b>to </b> tag needs to removed.Value 154 may or not be present in the file.
If the value 154 present , then the removal of the following part is needed
Code:
<b>
<c>
<st>154</st>
</c>
<d>
<st>1457954</st>
</d>
</b>

I want to do the coding in shell script. I can not use xslt because my system does not support xslt.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

2. Shell Programming and Scripting

read xml tag attribute and store it in variable

Hi, How to read xml tag attributes and store into variable in shell script? Thanks, Swetha (5 Replies)
Discussion started by: swetha123
5 Replies

3. Shell Programming and Scripting

How to remove some xml tag lines using shell script

I have existing XML file as below, now based on input string in shell script on workordercode i need to create a seprate xml file for e.g if we pass the input string as 184851 then it find the tag data from <workOrder>..</workOrder> and write to a new file and similarly next time if i pass the... (3 Replies)
Discussion started by: balrajg
3 Replies

4. Shell Programming and Scripting

shell command to remove some XML tag is needed

Hi all, I have a file which i have to remove some line from it, the lines that i have to remove from my file is as below: </new_name></w"s" langue="Fr-fr" version="1.0" encoding="UTF-8" ?> <New_name> and it is finding at the middle of my file, is there any command line in linux to do it or do... (10 Replies)
Discussion started by: id_2pc
10 Replies

5. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

6. UNIX for Advanced & Expert Users

Shell Script to read XML tags and the data within that tag

Hi unix Gurus, I am really new to Unix Scripting. Please help me to create a shell script which reads the xml file and from that i need to fetch a particular information. For example <SOURCE BUSINESSNAME ="" DATABASETYPE ="Teradata" DBDNAME ="DWPROD3" DESCRIPTION ="" NAME... (2 Replies)
Discussion started by: SmilePlease
2 Replies

7. Shell Programming and Scripting

How can I remove some xml tag lines using shell script?

Hi All, My name is Prathyu and I am working as a ETL develper. I have one requirement to create a XML file based on the provided XSD file. As per the Datastage standards Key(repeatable) field does not contain any Null values so I am inserting some dummy tag line to that XML file. ... (14 Replies)
Discussion started by: Prathyu
14 Replies

8. Shell Programming and Scripting

Modify XML tag using shell script

Hi All Need some help with a unix shell script. I have a XML file as shown below: <Root> <Service> <endPoint type="SOAP" protocol="http"> <provider>ABCD</provider> <urlRewrite>/service/xyz/getAccountDetails</urlRewrite> <timeout>30</timeout> </endPoint> </Service> <Service> <endPoint... (3 Replies)
Discussion started by: abhilwa
3 Replies

9. Shell Programming and Scripting

Print a closing XML tag shell script

I have a shell script that does everything I need it to do. But, when I was testing it I realized it doesn't print the closing XML tag.... Does anyone know how to incorporate printing the XML tag with my script? I am using AWK any help would be appreciated. (4 Replies)
Discussion started by: risarose87
4 Replies

10. Shell Programming and Scripting

Moving XML tag/contents after specific XML tag within same file

Hi Forum. I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script. Any feedback will be greatly appreciated. ... (19 Replies)
Discussion started by: pchang
19 Replies
xslt-config(1)						      General Commands Manual						    xslt-config(1)

NAME
xslt-config - script to get information about the installed version of libxslt SYNOPSIS
xslt-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--libs] [--cflags] [--version] [--help] DESCRIPTION
xslt-config is a tool that is used to determine the compile and linker flags that should be used to compile and link programs that use libxslt. OPTIONS
xslt-config accepts the following options: --version Print the currently installed version of libxslt on the standard output. --libs Print the linker flags that are necessary to link a libxslt program. --cflags Print the compiler flags that are necessary to compile a libxslt program. --prefix=PREFIX If specified, use PREFIX instead of the installation prefix that libxslt was built with when computing the output for the --cflags and --libs options. This option must be specified before any --libs or --cflags options. --exec-prefix=PREFIX If specified, use PREFIX instead of the executable prefix that libxslt was built with when computing the output for the --cflags and --libs options. This option must be specified before any --libs or --cflags options. AUTHORS
Daniel Veillard (daniel@veillard.com) NOTES
Source for libxslt is available on http://opensolaris.org. Documentation for libxslt is available on-line at http://www.xmlsoft.org/XSLT. 17 Jul 2002 xslt-config(1)
All times are GMT -4. The time now is 10:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy