Sponsored Content
Top Forums Shell Programming and Scripting regex/shell script to Parse through XML Records Post 302324719 by edgarvm on Thursday 11th of June 2009 01:43:22 PM
Old 06-11-2009
Maybe you must try with xpath , you can find a perl module for xml processing in cpan.org
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse a string in XML file using shell script

Hi! I'm just new here and don't know much about shell scripting. I just want to ask for help in creating a shell script that will parse a string or value of the status in the xml file. Please sample xml file below. Can you please help me create a simple script to get the value of status? Also it... (46 Replies)
Discussion started by: ayhanne
46 Replies

2. Shell Programming and Scripting

Parse XML file into CSV with shell?

Hi, It's been a few years since college when I did stuff like this all the time. Can someone help me figure out how to best tackle this problem? I need to parse a file full of entries that look like this: <eq action="A" sectyType="0" symbol="PGR" exch="CA" curr="VEF" sess="NORM"... (7 Replies)
Discussion started by: Pcushing
7 Replies

3. Shell Programming and Scripting

Need to Parse XML from bash script

I am completely new to bash scripting and now need to write a bash script that would parse a XML file and take out values from specific tags. I tried using xsltproc, xml_grep commands. But the issue is that the XML i am trying to parse is not UTF 8. so those commands are unable to parse my XML's... (4 Replies)
Discussion started by: shivashankar.g
4 Replies

4. Shell Programming and Scripting

Parse XML file in shell script

Hi Everybody, I have an XML file containing some data and i want to extract it, but the specific issue in my file is that the data is repeated some times like the following example : <section1> <subsection1> X=... Y=... Z=... <\subsection1> <subsection2> X=... Y=... Z=...... (2 Replies)
Discussion started by: yassine
2 Replies

5. Shell Programming and Scripting

Shell script (not Perl) to parse xml with awk

Hi, I have to make an script according to these: - I have couples of files like: xxxxxxxxxxxxx.csv xxxxxxxxxxxxx_desc.xml - every xml file has diferent fields, but keeps this format: ........ <defaultName>2011-02-25T16:43:43.582Z</defaultName> ........... (2 Replies)
Discussion started by: Pluff
2 Replies

6. Shell Programming and Scripting

awk Script to parse a XML tag

I have an XML tag like this: <property name="agent" value="/var/tmp/root/eclipse" /> Is there way using awk that i can get the value from the above tag. So the output should be: /var/tmp/root/eclipse Help will be appreciated. Regards, Adi (6 Replies)
Discussion started by: asirohi
6 Replies

7. Shell Programming and Scripting

How to Parse the XML data along with the URL in Shell Script?

Hi, Can anybody help to solve this. I want to parse some xmldata along with the URL in the Shell. I'm calling the URL via the curl command Given below is my shell script file export... (7 Replies)
Discussion started by: Megala
7 Replies

8. Shell Programming and Scripting

BASH script to parse XML and generate CSV

Hi All, Hope all you are doing good! Need your help. I have an XML file which needs to be converted CSV file. I am not an expert of awk/sed so your help is highly appreciated!! XML file looks like this: <l:event dateTime="2013-03-13 07:15:54.713" layerName="OSB" processName="ABC"... (2 Replies)
Discussion started by: bhaskar_m
2 Replies

9. Shell Programming and Scripting

Using shell command need to parse multiple nested tag value of a XML file

I have this XML file - <gp> <mms>1110012</mms> <tg>988</tg> <mm>LongTime</mm> <lv> <lkid>StartEle=ONE, Desti = Motion</lkid> <kk>12</kk> </lv> <lv> <lkid>StartEle=ONE, Source = Velocity</lkid> <kk>2</kk> </lv> <lv> ... (3 Replies)
Discussion started by: NeedASolution
3 Replies

10. Shell Programming and Scripting

Parse xml in shell script and extract records with specific condition

Hi I have xml file with multiple records and would like to extract records from xml with specific condition if specific tag is present extract entire row otherwise skip . <logentry revision="21510"> <author>mantest</author> <date>2015-02-27</date> <QC_ID>334566</QC_ID>... (12 Replies)
Discussion started by: madankumar.t@hp
12 Replies
XPATH(1p)						User Contributed Perl Documentation						 XPATH(1p)

NAME
xpath - a script to query XPath statements in XML documents. SYNOPSIS
xpath [-s suffix] [-p prefix] [-q] -e query [-e query] ... [file] ... DESCRIPTION
xpath uses the XML::XPath perl module to make XPath queries to any XML document. The XML::XPath module aims to comply exactly to the XPath specification at "http://www.w3.org/TR/xpath" and yet allows extensions to be added in the form of functions. The script takes any number of XPath pointers and tries to apply them to each XML document given on the command line. If no file arguments are given, the query is done using "STDIN" as an XML document. When multiple queries exist, the result of the last query is used as context for the next query and only the result of the last one is output. The context of the first query is always the root of the current document. OPTIONS
-q Be quiet. Output only errors (and no separator) on stderr. -s suffix Place "suffix" at the end of each entry. Default is a linefeed. -p prefix Place "prefix" preceding each entry. Default is nothing. BUGS
The author of this man page is not very fluant in english. Please, send him (fabien@tzone.org) any corrections concerning this text. See also XML::XPath(3pm). SEE ALSO
XML::XPath(3pm). HISTORY
This module is copyright 2000 Fastnet Software Ltd. This is free software, and as such comes with NO WARRANTY. No dates are used in this module. You may distribute this module under the terms of either the Gnu GPL, or under specific licencing from Fastnet Software Ltd. Special free licencing consideration will be given to similarly free software. Please don't flame me for this licence - I've put a lot of hours into this code, and if someone uses my software in their product I expect them to have the courtesy to contact me first. Full support for this module is available from Fastnet Software Ltd on a pay per incident basis. Alternatively subscribe to the Perl-XML mailing list by mailing lyris@activestate.com with the text: SUBSCRIBE Perl-XML in the body of the message. There are lots of friendly people on the list, including myself, and we'll be glad to get you started. Matt Sergeant, matt@sergeant.org This man page was added as well as some serious modifications to the script by Fabien Ninoles <fabien@debian.org> for the Debian Project. perl v5.10.1 2009-12-30 XPATH(1p)
All times are GMT -4. The time now is 06:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy