Sponsored Content
Top Forums Shell Programming and Scripting Shell Command to compare two xml lines while ignoring xml tags Post 302769117 by Shaishav Shah on Monday 11th of February 2013 08:59:50 AM
Old 02-11-2013
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 id="38,557"><columns><column><name>orge SMS call NO</name><value>&lt;![CDATA[message_id-13]]&gt;</value></column><column><name>username</name><value>&lt;![CDATA[ci_user-13]]&gt;</value></column><column><name>SENT TO</name><value>&lt;![CDATA[to_address-13]]&gt;</value></column><column><name>REPLY-TO ADDRESS</name><value>&lt;![CDATA[reply_to_address-13]]&gt;</value></column><column><name>TIME SENT</name><value>&lt;![CDATA[2010-08-08 21:47:40.274 UTC]]&gt;</value></column><column><name>TIME CLOSED</name><value>&lt;![CDATA[2010-08-08 22:08:16.216 UTC]]&gt;</value></column><column><name>STATE</name><value>&lt;![CDATA[state-13]]&gt;</value></column><column><name>REFUNDED</name><value>&lt;![CDATA[no]]&gt;</value></column><column><name>CLIENT IP</name><value>&lt;![CDATA[87.200.199.226]]&gt;</value></column><column><name>CURRENCY</name><value>&lt;![CDATA[key_ccy]]&gt;</value></column><column><name>PRICE</name><value>&lt;![CDATA[001.107]]&gt;</value></column></columns></record></recordSet></response>
File 2 :

HTML Code:
<response ticketId="1002" type="getQueryResults"><status>COMPLETE</status><description>Query results fetched successfully</description><recordSet totalCount="1" type="sms_records"><record id="38,557"><columns><column><name>orge SMS call NO</name><value>&lt;![CDATA[message_id-13]]&gt;</value></column><column><name>username</name><value>&lt;![CDATA[ci_user-13]]&gt;</value></column><column><name>SENT TO</name><value>&lt;![CDATA[to_address-13]]&gt;</value></column><column><name>REPLY-TO ADDRESS</name><value>&lt;![CDATA[reply_to_address-13]]&gt;</value></column><column><name>TIME SENT</name><value>&lt;![CDATA[2010-08-08 21:47:40.274 UTC]]&gt;</value></column><column><name>TIME CLOSED</name><value>&lt;![CDATA[2010-08-08 22:08:16.216 UTC]]&gt;</value></column><column><name>STATE</name><value>&lt;![CDATA[state-13]]&gt;</value></column><column><name>REFUNDED</name><value>&lt;![CDATA[no]]&gt;</value></column><column><name>CLIENT IP</name><value>&lt;![CDATA[87.200.199.226]]&gt;</value></column><column><name>CURRENCY</name><value>&lt;![CDATA[key_ccy]]&gt;</value></column><column><name>PRICE</name><value>&lt;![CDATA[001.107]]&gt;</value></column></columns></record></recordSet></response>

Now I am comparing this two files but want to ignore specific tags e.g. <ticketId="944"> and <totalCount="1">

How can i copmare two files while ignoring above values ?
 

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

how to search xml tags using unix shell

Hi All, Good day Here is my data: <Journal> <JournalCode>2</JournalCode> <JournalType>L</JournalType> <JournalEntry>SG</JournalEntry> <JournalAmount>-0.05</JournalAmount> </Journal> Problem: 1) I need to query the above tags in xml. Which is from the header <Journal>... (4 Replies)
Discussion started by: lutinoman
4 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. UNIX for Advanced & Expert Users

Shell Script to compare xml files and print output to a file

All, PLease can you help me with a shell script which can compare two xml files and print the difference to a output file. I have attached one such file for you reference. <Group> <Member ID=":Year_Quad:41501" childCount="4" fullPath="PEPSICO Year-Quad-Wk : FOLDER.52 Weeks Ending Dec... (2 Replies)
Discussion started by: kanthrajgowda
2 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. Shell Programming and Scripting

Compare two xml files while ignoring some xml tags

I've got two different files and want to compare them. File 1 : <response ticketId="944" type="getQueryResults"><status>COMPLETE</status><description>Query results fetched successfully</description><recordSet totalCount="1" type="sms_records"><record id="38,557"><columns><column><name>orge... (2 Replies)
Discussion started by: Shaishav Shah
2 Replies

7. Shell Programming and Scripting

How to add Xml tags to an existing xml using shell or awk?

Hi , I have a below xml: <ns:Body> <ns:result> <Date Month="June" Day="Monday:/> </ns:result> </ns:Body> i have a lookup abc.txtt text file with below details Month June July August Day Monday Tuesday Wednesday I need a output xml with below tags <ns:Body> <ns:result>... (2 Replies)
Discussion started by: Nevergivup
2 Replies

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

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

10. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies
xmltest(1)						      General Commands Manual							xmltest(1)

NAME
xmltest - Test script to send CIM-XML (via wbemcat) to CIMOM and compare to known results SYNOPSIS
xmltest [FILE] DESCRIPTION
xmltest is a script that is used to send a raw CIM-XML test file to the sfcb CIMOM (using wbemcat) and then compares the returned CIM-XML results against a previously determined 'OK' result file to check whether the returned results match the expected results. If there does not yet exist an 'OK' corresponding to the XML file then xmltest will save the returned results as the new OK file for later use. If the returned CIM-XML results don't match the existing 'OK' file a new 'result' file will be generated containing the erroneous results. If no FILE is specified xmltest will use all files with a .xml extension in the current directory path. EXAMPLE
If there is no 'OK' file to compare returned CIM-XML results against xmltest will generate one. # xmltest test/getclass.Linux_OperatingSystem.xml Running test test/getclass.Linux_OperatingSystem.xml ... OK Saving response as test/getclass.Linux_OperatingSystem.OK If the returned CIM-XML results match the existing 'OK' file xmltest will signal that the test passed. # xmltest test/getclass.Linux_OperatingSystem.xml Running test test/getclass.Linux_OperatingSystem.xml ... Passed If the returned CIM-XML results don't match the existing 'OK' file xmltest will signal that the tes failed and generate a 'result' file containing the erroneous results. # xmltest test/getclass.Linux_OperatingSystem.xml Running test test/getclass.Linux_OperatingSystem.xml ... FAILED Check test/getclass.Linux_OperatingSystem.result for errors PREREQUISITES
Requires wbemcat on search path. AUTHOR
Dr. Gareth S. Bestor <bestor@us.ibm.com> CONTRIBUTORS
Adrian Schuur <schuur@de.ibm.com> BUGS
Does not adequately deal with additional http headers/footers caused by chunking responses, which will result in false failures when com- paring results to existing "x.OK" files. The SBLIM project maintains a mailing list to which you should direct all questions regarding sfcb, sfcc, wbemcli, or any of the SBLIM providers. To subscribe to this mailing list visit http://lists.sourceforge.net/lists/listinfo/sblim-issues The SBLIM Project Bug tracking page can be found at http://sourceforge.net/tracker/?group_id=128809&atid=712784 COPYRIGHT
(C) Copyright IBM Corp. 2004, 2005 AVAILABILITY
The Small-Footprint CIM Broker (sfcb) is a part of the SBLIM project. The most recent version is available on the web at http://sblim.sourceforge.net/ SEE ALSO
wbemcat(1) xmltest Version 1.3.16 August 2005 xmltest(1)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy