Sponsored Content
Top Forums Shell Programming and Scripting Shell script to extract data in repeating tags from xml Post 302698143 by Scrutinizer on Saturday 8th of September 2012 09:23:05 AM
Old 09-08-2012
Hi,

What have you tried so far and where did you get stuck?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract data from xml- shell script using awk

Hi, This is the xml file that i have. - <front-servlet platform="WAS4.0" request-retriever="SiteMinder-aware" configuration-rescan-interval="60000"> <concurrency-throttle maximum-concurrency="50" redirect-page="/jsp/defaulterror.jsp" /> - <loggers> <instrumentation... (5 Replies)
Discussion started by: nishana
5 Replies

2. Shell Programming and Scripting

Help with shell script to extract data from XML file

Hello Scripting Gurus, I need help with extracting data from the XML file using shell script. The data is in a large XML and I need to extract the id values of all completedworkflows. Here is a sample of it. Input and output data is also in the attached text files. <wfregistry>... (5 Replies)
Discussion started by: yajaykumar
5 Replies

3. Shell Programming and Scripting

Perl script for extract data from xml files

Hi All, Prepare a perl script for extracting data from xml file. The xml data look like as AC StartTime="1227858839" ID="88" ETime="1227858837" DSTFlag="false" Type="2" Duration="303" /> <AS StartTime="1227858849" SigPairs="119 40 98 15 100 32 128 18 131 23 70 39 123 20 120 27 100 17 136 12... (3 Replies)
Discussion started by: allways4u21
3 Replies

4. UNIX for Dummies Questions & Answers

Extract repeating data from file

I want to extract the last rows of a data file, similar to that one below: C1 xxx C2 rrr C3 ttt .... Cn-1 hhh Cn bbb C1 yyy C2 sss C3 uuu ... Cn-1 iii Cn ccc ... I just want to extract the final rows between C1 and Cn at each data file. n is not a constant,... (2 Replies)
Discussion started by: natasha
2 Replies

5. Shell Programming and Scripting

awk and or sed command to sum the value in repeating tags in a XML

I have a XML in which <Amt Ccy="EUR">3.1</Amt> tag repeats. This is under another tag <Main>. I need to sum all the values of <Amt Ccy=""> (Ccy may vary) coming under <Main> using awk and or sed command. can some help? Sample looks like below <root> <Main> ... (6 Replies)
Discussion started by: bk_12345
6 Replies

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

7. Shell Programming and Scripting

How to extract data from xml file using shell scripting?

Hi evry1, This is my 1st post in this forum.Pls help me I want to extract some data froma xml file which has 2000 lines using shell scripting. Actually my xml file has some "audio and video codes" which i need to arrange in a column wise format after extracting it using shell scripting.I... (4 Replies)
Discussion started by: arun_kohan
4 Replies

8. Shell Programming and Scripting

How to extract data from XML file using shell scripting?

Hi , I have input file as XML. following are input data #complex.xml Code: <?xml version="1.0" encoding="UTF-8"?><TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance"> <ENTRY uid="123456"> <protein> <name>PROT001</name> <organism>Human</organism> ... (1 Reply)
Discussion started by: arun_kohan
1 Replies

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

10. UNIX for Beginners Questions & Answers

Extract XML block when value is matched (Shell script)

Hi everyone, So i'm struggling with an xml (log file) where we get information about some devices, so the logfile is filled with multiple "blocks" like that. Based on the <devId> i want to extract this part of the xml file. If possible I want it to have an script for this, cause we'll use... (5 Replies)
Discussion started by: Pouky
5 Replies
XO(1)							    BSD General Commands Manual 						     XO(1)

NAME
xo -- emit formatted output based on format string and arguments SYNOPSIS
xo [-options] [argument...] DESCRIPTION
The xo utility allows command line access to the functionality of the libxo library. Using xo, shell scripts can emit XML, JSON, or HTML using the same commands that emit text output. --close <path> Close tags for the given path --depth <num> Set the depth for pretty printing --help Display this help text --html OR -H Generate HTML output --json OR -J Generate JSON output --leading-xpath <path> Add a prefix to generated XPaths (HTML) --open <path> Open tags for the given path --pretty OR -p Make 'pretty' output (add indent, newlines) --style <style> Generate given style (xml, json, text, html) --text OR -T Generate text output (the default style) --version Display version information --warn OR -W Display warnings in text on stderr --warn-xml Display warnings in xml on stdout --wrap <path> Wrap output in a set of containers --xml OR -X Generate XML output --xpath Add XPath data to HTML output The xo utility accepts a format string suitable for xo_emit(3) and a set of zero or more arguments used to supply data for that string. xo "The {k:name} weighs {:weight/%d} pounds.0 fish 6 TEXT: The fish weighs 6 pounds. XML: <name>fish</name> <weight>6</weight> JSON: "name": "fish", "weight": 6 HTML: <div class="line"> <div class="text">The </div> <div class="data" data-tag="name">fish</div> <div class="text"> weighs </div> <div class="data" data-tag="weight">6</div> <div class="text"> pounds.</div> </div> The --wrap <path> option can be used to wrap emitted content in a specific hierarchy. The path is a set of hierarchical names separated by the '/' character. xo --wrap top/a/b/c '{:tag}' value XML: <top> <a> <b> <c> <tag>value</tag> </c> </b> </a> </top> JSON: "top": { "a": { "b": { "c": { "tag": "value" } } } } The --open <path> and --close <path> can be used to emit hierarchical information without the matching close and open tag. This allows a shell script to emit open tags, data, and then close tags. The --depth option may be used to set the depth for indentation. The --leading-xpath may be used to prepend data to the XPath values used for HTML output style. #!/bin/sh xo --open top/data xo --depth 2 '{tag}' value xo --close top/data XML: <top> <data> <tag>value</tag> </data> </top> JSON: "top": { "data": { "tag": "value" } } EXAMPLE
% xo 'The {:product} is {:status}0 stereo "in route" The stereo is in route % xo -p -X 'The {:product} is {:status}0 stereo "in route" <product>stereo</product> <status>in route</status> ADDITIONAL DOCUMENTATION
Complete documentation can be found on github: http://juniper.github.io/libxo/libxo-manual.html libxo lives on github as: https://github.com/Juniper/libxo The latest release of libxo is available at: https://github.com/Juniper/libxo/releases SEE ALSO
libxo(3), xo_emit(3) HISTORY
The libxo library was added in FreeBSD 11.0. AUTHOR
Phil Shafer BSD
December 4, 2014 BSD
All times are GMT -4. The time now is 07:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy