Sponsored Content
Top Forums Shell Programming and Scripting Parse XML file into CSV with shell? Post 302261860 by samsbery on Tuesday 25th of November 2008 08:26:25 PM
Old 11-25-2008
Instead of doing it in shell (sed/awk), better use any XML parser. May be you can write a simple script in Perl or any scripting languages which support XML parsing.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to parse a XML file using PERL and XML::DOm

I need to know the way. I have got parsing down some nodes. But I was unable to get the child node perfectly. If you have code please send it. It will be very useful for me. (0 Replies)
Discussion started by: girigopal
0 Replies

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

3. Shell Programming and Scripting

regex/shell script to Parse through XML Records

Hi All, I have been working on something that doesn't seem to have a clear regex solution and I just wanted to run it by everyone to see if I could get some insight into the method of solving this problem. I have a flat text file that contains billing records for users, however the records... (5 Replies)
Discussion started by: Jerrad
5 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

Korn shell program to parse CSV text file and insert values into Oracle database

Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database. I need to write the korn shell program on Red Hat Enterprise Linux server. Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies

6. Shell Programming and Scripting

Extract and parse XML data (statistic value) to csv

Hi All, I need to parse some statistic data from the "measInfo" -eg. 25250000 (as highlighted) and return the result into line by line, and erasing all other unnecessary info/tag. Thought of starting with grep "measInfoID="25250000" but this only returns 1 line. How do I get all the output... (8 Replies)
Discussion started by: jackma
8 Replies

7. UNIX for Dummies Questions & Answers

Help to parse csv file with shell script

Hello ! I am very aware that this is not the first time this question is asked here, because I have already read a lot of previous answers, but none of them worked, so... As said in the title, I want to read a csv file with a bash script. Here is a sample of the file: ... (4 Replies)
Discussion started by: Grhyll
4 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

Pass some data from csv to xml file using shell/python

Hello gurus, I have a csv file with bunch of datas in each column. (see attached) Now I have an .xml file in the structure of below: ?xml version="1.0" ?> <component id="root" name="root"> <component id="system" name="system"> <param name="number_of_A" value="8"/> ... (5 Replies)
Discussion started by: Zam_1234
5 Replies
XML_PARSER_SET_OPTION(3)						 1						  XML_PARSER_SET_OPTION(3)

xml_parser_set_option - Set options in an XML parser

SYNOPSIS
bool xml_parser_set_option (resource $parser, int $option, mixed $value) DESCRIPTION
Sets an option in an XML parser. PARAMETERS
o $parser - A reference to the XML parser to set an option in. o $option - Which option to set. See below. The following options are available: XML parser options +---------------------------+--------------------------------------+---+ | Option constant | | | | | | | | | Data type | | | | | | | | Description | | | | | | +---------------------------+--------------------------------------+---+ | | | | | XML_OPTION_CASE_FOLDING | | | | | | | | | integer | | | | | | | | Controls whether case-folding is | | | | enabled for this XML parser. Enabled | | | | by default. | | | | | | | | | | | XML_OPTION_SKIP_TAGSTART | | | | | | | | | integer | | | | | | | | Specify how many characters should | | | | be skipped in the beginning of a tag | | | | name. | | | | | | | | | | | XML_OPTION_SKIP_WHITE | | | | | | | | | integer | | | | | | | | Whether to skip values consisting | | | | of whitespace characters. | | | | | | | | | | |XML_OPTION_TARGET_ENCODING | | | | | | | | | string | | | | | | | | Sets which target encoding to use | | | | in this XML parser.By default, it is | | | | set to the same as the source encod- | | | | ing used by xml_parser_create(3). | | | | Supported target encodings are | | | | ISO-8859-1, US-ASCII and UTF-8. | | | | | | +---------------------------+--------------------------------------+---+ o $value - The option's new value. RETURN VALUES
This function returns FALSE if $parser does not refer to a valid parser, or if the option could not be set. Else the option is set and TRUE is returned. PHP Documentation Group XML_PARSER_SET_OPTION(3)
All times are GMT -4. The time now is 04:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy