Sponsored Content
Full Discussion: Search in xml tags
Top Forums UNIX for Advanced & Expert Users Search in xml tags Post 302572426 by svenkatareddy on Thursday 10th of November 2011 02:37:14 AM
Old 11-10-2011
Search in xml tags

I have a xml file like below. I want to search in <msg>, if found corresponding tag path needs to fetch.

for eg: for the message 'RM1659 Boeing Exception Management' it should return /trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip
For message it can have many paths.

Please give me a correct commands to find it.

Code:
<?xml version="1.0"?>
<log>
<logentry
   revision="428">
<date>2011-09-23T07:25:28.059356Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Transfer_SMRTVW_DBF.zip</path>
</paths>
<msg>Redmine : 613 FTP details moved to parameters table </msg>
</logentry>
<logentry
   revision="373">
<date>2011-08-26T12:36:11.583506Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
</paths>
<msg>RM1659 Boeing Exception Management</msg>
</logentry>
<logentry
   revision="372">
<date>2011-08-26T12:32:51.179995Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
</paths>
<msg>RM1659 Boeing Exception Management</msg>
</logentry>
<logentry
   revision="175">
<date>2011-06-21T10:44:43.849019Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Transfer_SMRTVW_DBF.zip</path>
</paths>
<msg>Redmine Issue 1233:
* Modified the JET for tSCPPut_main.javajet to re-raise the Java exception on SCP Put failure.
* Added a tDie step to abort if SCP file rename fails.  Checking for status "File rename OK" to detect success.</msg>
</logentry>
<logentry
   revision="52">
<date>2011-05-17T11:41:14.775777Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
</paths>
<msg>Added logging statements for file paths.</msg>
</logentry>
<logentry
   revision="47">
<date>2011-05-16T07:56:47.727376Z</date>
<paths>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Smartview.zip</path>
<path
   kind="file"
   action="M">/trunk/talend/source/SITA_SP7/Job_Designs/DeferredOutputs/SmartViewFiles/DO_Transfer_SMRTVW_DBF.zip</path>
</paths>
<msg>Fixing issues after the initial implementation of changes corresponding to
Redmine Issue 801 - Modified the file path in the Fetch File Names Component in DO_transfer_SMRTVW_DBF and DO_Smartview jobs.</msg>
</logentry>


Last edited by fpmurphy; 11-10-2011 at 11:12 AM.. Reason: code tags please
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Search for xml tags in a file

Hi, I need to search for a pattern like : <A:UserAttr Name="ACTIVITY_ID"> <A:Value>1111120</A:Value> </A:UserAttr> Let us the there is a dir /tmp that contains 5 xml file. each of them multiple above tags in the file. If found all the three line would be... (2 Replies)
Discussion started by: tictactoe
2 Replies

2. Shell Programming and Scripting

how to search a value from a xml

I have a file which has following content. <drdata_export> <drdata> <tags> <timestamp>1231420399:617026000</timestamp> <from_ip_address>67.178.40.168</from_ip_address> <to_ip_address>76.96.6.6</to_ip_address> ... (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies

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

4. Shell Programming and Scripting

Print a pattern between the xml tags based on a search pattern

Hi all, I am trying to extract the values ( text between the xml tags) based on the Order Number. here is the sample input <?xml version="1.0" encoding="UTF-8"?> <NJCustomer> <Header> <MessageIdentifier>Y504173382</MessageIdentifier> ... (13 Replies)
Discussion started by: oky
13 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

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

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

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

9. Shell Programming and Scripting

Search and replace the string with new word using xml tags

Hi All i need to replace the url1 inside <remote> tag in below xml in first instance and in the second instance with url2. any help appreciated <locations> <hudson.scm.SubversionSCM_-ModuleLocation> <remote>https://svn2015.com/svn/repos/internalshard</remote> ... (4 Replies)
Discussion started by: madankumar.t@hp
4 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
SVNPATH(1)                                                                                                                              SVNPATH(1)

NAME
svnpath - output svn url with support for tags and branches SYNOPSIS
svnpath svnpath tags svnpath branches svnpath trunk DESCRIPTION
svnpath is intended to be run in a Subversion working copy. In its simplest usage, svnpath with no parameters outputs the svn url for the repository associated with the working copy. If a parameter is given, svnpath attempts to instead output the url that would be used for the tags, branches, or trunk. This will only work if it's run in the top-level directory that is subject to tagging or branching. For example, if you want to tag what's checked into Subversion as version 1.0, you could use a command like this: svn cp $(svnpath) $(svnpath tags)/1.0 That's much easier than using svn info to look up the repository url and manually modifying it to derive the url to use for the tag, and typing in something like this: svn cp svn+ssh://my.server.example/svn/project/trunk svn+ssh://my.server.example/svn/project/tags/1.0 svnpath uses a simple heuristic to convert between the trunk, tags, and branches paths. It replaces the first occurrence of trunk, tags, or branches with the name of what you're looking for. This will work ok for most typical Subversion repository layouts. If you have an atypical layout and it does not work, you can add a ~/.svnpath file. This file is perl code, which can modify the path in $url. For example, the author uses this file: #!/usr/bin/perl # svnpath personal override file # For d-i I sometimes work from a full d-i tree branch. Remove that from # the path to get regular tags or branches directories. $url=~s!d-i/(rc|beta)[0-9]+/!!; $url=~s!d-i/sarge/!!; 1 LICENSE
GPL version 2 or later AUTHOR
Joey Hess <joey@kitenet.net> Debian Utilities 2013-12-23 SVNPATH(1)
All times are GMT -4. The time now is 12:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy