Sponsored Content
Top Forums Shell Programming and Scripting How to extract data from xml file using shell scripting? Post 302843132 by ahamed101 on Monday 12th of August 2013 07:06:58 AM
Old 08-12-2013
For the pattern you pasted, try this...
Code:
awk '-F"' '{split($4,o,/ /);print NR"."$2" "o[1]" "o[2]" "o[4]}' input_file

--ahamed
 

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

extract specific data from xml format file.

Hi, I need to extract the start time value (bold, red font) under the '<LogEvent ID="Timer Start">' tag (black bold) from a file with the following pattern. There are other LogEventIDs listed in the file as well, making it harder for me to extract out the specific start time that I need. . .... (7 Replies)
Discussion started by: 60doses
7 Replies

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

4. Shell Programming and Scripting

sed or awk to extract data from Xml file

Hi, I want to get data from Xml file by using sed or awk command. I want to get the following result : mon titre 1;Createur1;Dossier1 mon titre 1;Createur1;Dossier1 and save it in cvs file (fichier.cvs). FROM this Xml file (test.xml): <playlist version="1"> <trackList> <track>... (1 Reply)
Discussion started by: yeclota
1 Replies

5. Shell Programming and Scripting

Shell scripting to extract data from file

Hi, i want to fetch the data from the alert log file, for a particular time interval. Example : Alert log content : Thu Mar 18 08:47:36 2010 Completed: alter database open Thu Mar 18 19:13:38 2010 MMNL absent for 6390 secs; Foregrounds taking over Fri Mar 19 08:30:52 2010... (1 Reply)
Discussion started by: Pinki018
1 Replies

6. Shell Programming and Scripting

Data Extract from XML Log File

Please help me out to extract the Data from the XML Log files. So here is the data ERROR|2010-08-26 00:05:52,958|SERIAL_ID=128279996|ST=2010-08-2600:05:52|DEVICE=113.2.21.12:601|TYPE=TransactionLog... (9 Replies)
Discussion started by: raghunsi
9 Replies

7. Shell Programming and Scripting

Shell script to extract data in repeating tags from xml

Hi, I am new to shell scripting. I need to extract data between repeating tags from an xml file and store the data in an array to process it further. <ns1:root xmlns:ns1="http://example.com/config"> <ns1:interface>in1</ns1:interface> <ns1:operation attribute1="true" attribute2="abd"... (2 Replies)
Discussion started by: sailendra
2 Replies

8. Shell Programming and Scripting

Extract data from XML file

Hi , I have input file as XML. following are input data #complex.xml <?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: mohan sharma
1 Replies

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

10. Shell Programming and Scripting

Extract Data from XML file.

Hi Guys, I am in a need to extract data from a xml file. The XML file format is as below. <data jsxnamespace="propsbundle" locales=""> <locale> <!--Error messages starts--> <record jsxid="CHARPAIR001" jsxtext=" must be selected"></record> <record... (1 Reply)
Discussion started by: Showdown
1 Replies
IVMCONFIGACTIONS.XML(5) 					File Formats Manual					   IVMCONFIGACTIONS.XML(5)

NAME
IvmConfigActions.xml - actions to be performed by ivman(8) DESCRIPTION
IvmConfigActions.xml specifies which actions are to be performed by ivman(8) when a device is inserted/attached to the system, where an action is defined as mounting the device or executing a program. IvmConfigActions.xml is parsed as an XML file. The general form of the file is: <?xml version="1.0" encoding="UTF-8"?> <ivm:ActionsConfig version="0.2" xmlns:ivm="http://www.eikke.com/ivm"> <ivm:Match name="matchname" value="matchvalue"> <ivm:Option name="optionname1" value="optionvalue1" /> <ivm:Option name="optionname2" value="optionvalue2" /> ... </ivm:Match> ... </ivm:ActionsConfig> Each time a device is added to the system, this file is parsed. If, for a Match element, matchname=matchvalue is true for the new device, then the Match or Option elements within that Match element are parsed. A Match element can have any of the following names: ivm.mountable Whether or not HAL specifies that a device can and should be mounted. Must be "true" or "false". hal.anything The string in place of "anything" will be taken as the name of a HAL property string for the device, and the value of the prop- erty will be compared to the value given. Run 'lshal' to see a list of HAL properties which can be used here. * Match every device. Use with care! An Option element can have any of the following names: checkOnInit If set to 'true', IvmConfigActions.xml will be parsed when Ivman starts and rules will be applied to all devices currently attached to the system. This can be used to, for example, mount any removable devices attached to the system when Ivman starts. This option should be specified outside of any 'match' constructs. mount Whether or not to mount the device. Must be "true" or "false". If more than one value applies to a device, then the one clos- est to the end of the file will be used. exec A command to execute when the device or disc is inserted. The amount of commands per device is unlimited. execun A command to execute when the device or disc is removed. The amount of commands per device is unlimited. Note that HAL prop- erty substitution is limited for execun; since the device no longer exists when the command is executed, we cannot get informa- tion about it from HAL, therefore any substitution will occur with the property values at the time of device insertion (or mounting if Ivman mounted it), NOT removal. execdvd A command to execute when the device is inserted if the device is a volume containing DVD-format video. The amount of commands per device is unlimited. NOTE: execdvd is deprecated! A HAL property now exists to indicate whether or not a DVD contains video - volume.disc.is_videodvd . exec, execdvd and execun support substitution of HAL device properties. This is accomplished by surrounding the property name with $ sym- bols. For instance, if $hal.volume.mount_point$ is within a command, it will be replaced with the volume's mount point before execution. No character escaping is done in the substitution, but the characters ' and " are replaced with ?, so you can surround the substitution with quotes without fear. Remember that this is an XML file, which means that characters which have a special meaning in XML (entities) need to be escaped. Some characters which are popular in shell scripting (&, <, >) are among these special characters. As a quick reference, & becomes &amp; , < becomes &lt; , > becomes &gt; , ' becomes &apos; and " becomes &quot; . As many Matches can be nested as is desired, and as many Matches and Options can be placed within a Match as is desired. This, along with the ability to test HAL properties, makes Ivman quite flexible; see the examples below. EXAMPLES
<!-- autoplay video DVDs --> <ivm:Match name="hal.volume.disc.type" value="dvd_rom"> <ivm:Option name="execdvd" value="xine -f -g -D dvd:$hal.block.device$" /> </ivm:Match> <!-- autoplay audio CDs --> <ivm:Match name="hal.volume.disc.type" value="cd_rom"> <ivm:Match name="hal.volume.disc.has_audio" value="true"> <ivm:Match name="hal.volume.disc.has_data" value="false"> <ivm:Option name="exec" value="cdplay -d $hal.block.device$ -c" /> </ivm:Match> </ivm:Match> </ivm:Match> <!-- blacklist some partitions we don't want mounted --> <ivm:Match name="hal.block.device" value="/dev/hda5"> <ivm:Option name="mount" value="false" /> </ivm:Match> <ivm:Match name="hal.block.device" value="/dev/hda2"> <ivm:Option name="mount" value="false" /> </ivm:Match> Many more examples are given in the default file provided with Ivman. SEE ALSO
ivman(8), IvmConfigBase.xml(5), IvmConfigProperties.xml(5), IvmConfigConditions.xml(5) 12 May 2005 IVMCONFIGACTIONS.XML(5)
All times are GMT -4. The time now is 07:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy