How to arrange xml tags in single row using shell script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to arrange xml tags in single row using shell script?
# 1  
Old 06-18-2012
How to arrange xml tags in single row using shell script?

I want to put one xml record in one row and so on...
sample two records are here.
Code:
<?xml version="1.0"?>
<Object>
  <Header>
    <XCOMVers>V1.0</XCOMVers>
    <REPORT>XXXXX</REPORT>
    <CODE>002</CODE>
  </Header>
  <IssueCard>
    <Record>
	<L>CAR SYSTEM           -SSSSS  -</L>
      <L>                          CODE:      202</L>
      <L>---</L>
      <L>Message:</L>
      <L>:21:XXXXXXXX</L>
      <L>:103B:/1213-XX736472-567GH0</L>
      <L>---</L>
      <L>Confirm:</L>
    </Record>
  </IssueCard>
</Object>
<?xml version="1.0"?>
<Object>
  <Header>
    <XCOMVers>V1.0</XCOMVers>
    <REPORT>XXXXX</REPORT>
    <CODE>002</CODE>
  </Header>
  <IssueCard>
    <Record>
	<L>CAR SYSTEM           -SSSSS  -</L>
      <L>                          CODE:      202</L>
      <L>---</L>
      <L>Message:</L>
      <L>:21:XXXXXXXX</L>
      <L>:103B:/1213-XX736472-567GH0</L>
      <L>---</L>
      <L>Confirm:</L>
    </Record>
  </IssueCard>
</Object>

I want output as :
Code:
<?xml version="1.0"?><Object>  <Header>    <XCOMVers>V1.0</XCOMVers>    <REPORT>XXXXX</REPORT>    <CODE>002</CODE>  </Header> <IssueCard>    <Record>	<L>CAR SYSTEM           -SSSSS  -</L>      <L>                          CODE:      202</L>      <L>---</L>      <L>Message:</L>      <L>:21:XXXXXXXX</L>      <L>:103B:/1213-XX736472-567GH0</L>      <L>---</L>      <L>Confirm:</L>    </Record>  </IssueCard></Object>
<?xml version="1.0"?><Object>  <Header>    <XCOMVers>V1.0</XCOMVers>    <REPORT>XXXXX</REPORT>    <CODE>002</CODE>  </Header> <IssueCard>    <Record>	<L>CAR SYSTEM           -SSSSS  -</L>      <L>                          CODE:      202</L>      <L>---</L>      <L>Message:</L>      <L>:21:XXXXXXXX</L>      <L>:103B:/1213-XX736472-567GH0</L>      <L>---</L>     <L>Confirm:</L>    </Record>  </IssueCard></Object>

Please guys need help.
# 2  
Old 06-18-2012
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read xml tags and then remove the tag using shell script

<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 (3 Replies)
Discussion started by: RJG
3 Replies

2. Shell Programming and Scripting

Getting error while including values in xml tags using shell script

Hi All, Please find the code below where I want to add the variable value in between the XML tags. I am taking one string and my goal is to put them between the xml tags. Ex : in between <name> , <lname> Kindly suggest a correction because while executing this script I am getting and... (8 Replies)
Discussion started by: rajneesh4U
8 Replies

3. Shell Programming and Scripting

Need row number with Xml tags value

Hi, Need help. My source file contain data like: 1 <?xml version="1.0"?> <Status>EGZAAE09</Status><Perform>002</Perform><DATE>2013-05-27</DATE> 1 <?xml version="1.0"?> <Status>ECBAE09</Status><Perform>002</Perform><DATE>2013-05-27</DATE> 2 <?xml version="1.0"?>... (3 Replies)
Discussion started by: sene_geet
3 Replies

4. 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

5. Shell Programming and Scripting

Shell scripting - need to arrange the columns from multiple file into a single file

Hi friends please help me on below, i have 5 files like below file1 is x 10 y 20 z 15 file2 is x 100 z 245 file3 is y 78 z 23 file4 is x 100 (3 Replies)
Discussion started by: siva kumar
3 Replies

6. Shell Programming and Scripting

Shell Command to compare two xml lines while ignoring xml tags

I've got two different files and want to compare them. File 1 : HTML Code: <response ticketId="944" type="getQueryResults"><status>COMPLETE</status><description>Query results fetched successfully</description><recordSet totalCount="1" type="sms_records"><record... (1 Reply)
Discussion started by: Shaishav Shah
1 Replies

7. Shell Programming and Scripting

Shell script to extract data in repeating tags from xml

Hi, I am new to shell scripting. I need to extract data between repeating tags from an xml file and store the data in an array to process it further. <ns1:root xmlns:ns1="http://example.com/config"> <ns1:interface>in1</ns1:interface> <ns1:operation attribute1="true" attribute2="abd"... (2 Replies)
Discussion started by: sailendra
2 Replies

8. Shell Programming and Scripting

How to arrange xml tags in single row using shell script?

I want to put one xml record in one row and so on... sample two records are here. <?xml version="1.0"?> <Object> <Header> <XCOMVers>V1.0</XCOMVers> <REPORT>XXXXX</REPORT> <CODE>002</CODE> </Header> <IssueCard> <Record> <L>CAR SYSTEM -SSSSS -</L> ... (3 Replies)
Discussion started by: sene_geet
3 Replies

9. Shell Programming and Scripting

Replacing number between xml tags with ksh shell script

Hallo, im basically a complete noob on shell scripting and im trying to replace or rather add 1 to a number between xml tags. The xml basically has a tag somewhere that looks like this: <tag>12345678901234</tag> Now i want to replace the number between the tags. And i want the file to... (6 Replies)
Discussion started by: Demoric
6 Replies

10. Shell Programming and Scripting

Arrange values of a column in row

HI, I need to arrange values of a colum in row. e.g. input file : Alpha<>123 AAAA<>6754 Beta<>456 BBBB<>63784 CCC<>783 Gama<>789 Alpha<>555 AAAA<>6754 BBBB<>63784 Beta<>666 CCC<>783 Gama<>888 (9 Replies)
Discussion started by: The_Archer
9 Replies
Login or Register to Ask a Question