Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Parsing XML dynamic data via awk? Post 9776 by rwb1959 on Friday 2nd of November 2001 11:40:30 AM
Old 11-02-2001
Damn...

The XML strings disappeard in the previous post...
Note I changed all the angle brackets "<" to square
brackets "[". you'll have to translate them back.

script...

#!/bin/sh

awk '/[Number]/ {stp=index($0,">")+1; \
newstr=substr($0,stp); \
etp=index(newstr,"<")-1; \
print substr(newstr,0,etp); \
}' test.xml


test.xml

[String]one[/String]
[Number]two[/Number]
[String]three[/String]
[Number]four[/Number]


Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing and getting data from XML file using ksh script

Hi All, I have a xml file for example as described below <xml> <address> <street><street> <address/> <isbn>426728783932020308393930303</isbn> <book> <name> </name> </book> . . . </xml> My problem is to get the isbn number from the above described file using ksh script. Could... (6 Replies)
Discussion started by: vinna
6 Replies

2. Shell Programming and Scripting

parsing xml using awk

hello , i am trying to parse xml using awk however its a little bit tricky as i want <databases> <source> <host>prod</host> <port>1522</port> <tns>GP1</tns> <user>P11</user>... (6 Replies)
Discussion started by: amit1_x
6 Replies

3. Shell Programming and Scripting

Parsing posted XML data from a remote server?

Hi Is it possible to parse a posted xml data from a remote server in unix shell script. if so how to do that? and i need to give this script path in the push url (in remote server) . how to do this? I have tried this in asp but could not succeed....so am trying in shell scripting...the thread... (1 Reply)
Discussion started by: aemunathan
1 Replies

4. Shell Programming and Scripting

Parsing dynamic data from a command output

Hi people, I am writing a korn shell script, and one of the command gives an output something like below: release.label.2010.03.02 objects: /project/path/to/some/file_name.ksh /project/path/another/file_name01.dat I have to retrieve the file paths one by one & use them as... (9 Replies)
Discussion started by: kiwin1000
9 Replies

5. Shell Programming and Scripting

parsing data from xml file is failing can't open variable

Created a korn shell script, everything is is working except this section, the variable $SYSINFO is being set, but the NASIP & NASDEV are failing, it appears to be treating the config.xml file config directory and xml as the file. Need a second set of eyes to tell me where I am messing up. #... (3 Replies)
Discussion started by: juanb25
3 Replies

6. Shell Programming and Scripting

xml parsing with awk

hi all.. need your help again.. i have xml file and i want to parsing some data from the xml file.. <ex-name="keroco"> <................> <................> <................> <br-name="cincai"> <ship="123456"> <...................> ... (3 Replies)
Discussion started by: buncit8
3 Replies

7. Shell Programming and Scripting

Help - Parsing data in XML in Linux

Hi, I have an XML file in Linux and it contains a long string of characters. The last part of the file is like ....... ....... ....... CAD</MarketDescription></InvestorTransaction></AdvisorAccount></DivisionAdvisor></Division>... (3 Replies)
Discussion started by: naveed
3 Replies

8. Shell Programming and Scripting

XML Parsing using awk

Hi All, I have a problem to resolve. For following XML file, I need to parse the values based on Tag Name. I would prefer to use this by awk. I have used sed command to replace the tags (s/<SeqNo>//). In this case there can be new tags introduced. So need to parse it based on Tag Name. Any... (9 Replies)
Discussion started by: Tons
9 Replies

9. Shell Programming and Scripting

Parsing XML (and insert data) then output data (bash / Solaris)

Hi folks I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file. It all works - apart from the xml and config file format in the new file with XML files the original XML (that ends up in... (2 Replies)
Discussion started by: dfinch
2 Replies

10. Shell Programming and Scripting

Parsing custom data into xml in Shell

Hi , I have data as below in a text file { 'AAA' => { 'A1' => 'a1 comment', 'A2' => 'a2 comment' }, 'BBB' => { 'B1' => 'b1 comment' }, 'CCC' => { 'C1' => 'c1 comment', 'C2' => 'c2 comment', 'C3' => 'c3 comment' 'C4' => 'c4... (2 Replies)
Discussion started by: vivek d r
2 Replies
XML::Grove::Path(3)					User Contributed Perl Documentation				       XML::Grove::Path(3)

NAME
XML::Grove::Path - return the object at a path SYNOPSIS
use XML::Grove::Path; # Using at_path method on XML::Grove::Document or XML::Grove::Element: $xml_obj = $grove_object->at_path("/some/path"); # Using an XML::Grove::Path instance: $pather = XML::Grove::Path->new(); $xml_obj = $pather->at_path($grove_object); DESCRIPTION
"XML::Grove::Path" returns XML objects located at paths. Paths are strings of element names or XML object types seperated by slash ("/") characters. Paths must always start at the grove object passed to `"at_path()"'. "XML::Grove::Path" is not XPath, but it should become obsolete when an XPath implementation is available. Paths are like URLs /html/body/ul/li[4] /html/body/#pi[2] The path segments can be element names or object types, the objects types are named using: #element #pi #comment #text #cdata #any The `"#any"' object type matches any type of object, it is essentially an index into the contents of the parent object. The `"#text"' object type treats text objects as if they are not normalized. Two consecutive text objects are seperate text objects. AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us SEE ALSO
perl(1), XML::Grove(3) Extensible Markup Language (XML) <http://www.w3c.org/XML> perl v5.16.3 1999-08-17 XML::Grove::Path(3)
All times are GMT -4. The time now is 08:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy