Sponsored Content
Top Forums Shell Programming and Scripting Parse an XML task list to create each task.xml file Post 302256192 by MissI on Saturday 8th of November 2008 02:53:04 PM
Old 11-08-2008
Parse an XML task list to create each task.xml file

I have an task definition listing xml file that contains a list of tasks such as

Code:
<TASKLIST
    <TASK definition="Completion date" id="Taskname1" Some other 
         <CODE name="Code12" 
               <Parameter pname="Dog" input="5.6" units="feet" etc /Parameter>
               <Parameter pname="Cat" input="cute" units="NA"      /Parameter>
          /CODE>
     /TASK>
<TASK definition="Completion date" id="Taskname2" Some other 
         <CODE name="Code3" 
          /CODE>
         <CODE name="Code2" 
           /CODE>
     /TASK>
/TASKLIST>

I need to parse the task list into seperate task xml files starting from the <TASK tag to the /TASK> tag using the TASK id for the *.xml name.

I have written a grep command to capture all id names and then a sed command along with another grep command to clean up everything except the id leaving me with a list of just Task id names. My code is not eloquant, but works.

Now I am stuck. Please help. I am a novice at Unix scripting.

Last edited by bakunin; 11-08-2008 at 06:29 PM.. Reason: Please use code-tags areoun code!
 

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

comment and Uncomment single task out of multiple task

I have a file contains TASK gsnmpproxy { CommandLine = $SMCHOME/bin/gsnmpProxy.exe } TASK gsnmpdbgui { CommandLine = $SMCHOME/bin/gsnmpdbgui.exe I would like to comment and than uncomment specific task eg TASK gsnmpproxy Pls suggest how to do in shell script (9 Replies)
Discussion started by: madhusmita
9 Replies

3. Shell Programming and Scripting

How can I parse xml file?

How can I parse file containing xml ? I am sure that its best to use perl - but my perl is not very good - can someone help? Example below contents of file containing the xml - I basically want to parse the file and have each field contained in a variable.. ie. I want to store the account... (14 Replies)
Discussion started by: frustrated1
14 Replies

4. Shell Programming and Scripting

parse xml file

Hello all, Given the following extract from a xml file with multiple <JOB> .... </JOB> entries <JOB APPLICATION="APP" APR="0" AUG="0" AUTHOR="AUT" AUTOARCH="0" CMDLINE="/tmp/test1 %%var" CONFIRM="1" CREATION_DATE="20100430" CREATION_TIME="130739" ... (2 Replies)
Discussion started by: cabrao
2 Replies

5. Shell Programming and Scripting

Create xml file using a content from another xml file

I need to create a xml file(master.xml) with contents from another xml files(children). I have below list of xml files in a temporary location (C:/temp/xmls) 1. child1.xml 2. child2.xml Below is the content of the child1.xml & child2.xml files, child1.xml <root> <emp> ... (3 Replies)
Discussion started by: vel4ever
3 Replies

6. UNIX for Dummies Questions & Answers

Need help how to create a file (xml) list all files from directory

I have more than 10K songs in two directories on a hard drive. I would like to create a file list all of files name then change to .xml extension to upload to iPhone so I have a Karaoke list on my iPhone. I need your help to create a file by using command in Linux. Files names: 0001 More... (4 Replies)
Discussion started by: ggcc
4 Replies

7. UNIX for Dummies Questions & Answers

Parse xml file

HI Guys, Input .XML <xn:MeContext id="L0307"> <xn:ManagedElement id="1"> <xn:VsDataContainer id="1"> <xn:attributes> <xn:vsDataType>vsDataENodeBFunction</xn:vsDataType> ... (3 Replies)
Discussion started by: pareshkp
3 Replies

8. Shell Programming and Scripting

Extract strings from XML files and create a new XML

Hello everybody, I have a double mission with some XML files, which is pretty challenging for my actual beginner UNIX knowledge. I need to extract some strings from multiple XML files and create a new XML file with the searched strings.. The original XML files contain the source code for... (12 Replies)
Discussion started by: milano.churchil
12 Replies

9. Shell Programming and Scripting

Create one xml file from one list of names

Actually I have one list of channels names like: Rai 1 Rai 1 +1HD Rai 1 +2HD Rai 2 Rai 2 +1HD Rai 2 +2HD . . . .From this list of names I need create one new xml file with this structure <channel id="Rai 1"> <display-name lang="it">Rai 1</display-name> <icon... (3 Replies)
Discussion started by: Tapiocapioca
3 Replies

10. UNIX for Beginners Questions & Answers

Need list of input and output parameter of task in a text file, using shell script

//file begin ===== //some code task abcd_; input x; input y,z; //some comment output w; //some comment reg p; integer q; begin //some code end endtask : abcd_ //some code //file end ===== expected output from above... (1 Reply)
Discussion started by: rishifrnds
1 Replies
EVTEST-CAPTURE(1)														 EVTEST-CAPTURE(1)

NAME
evtest-capture - Input device event capture program SYNOPSIS
evtest-capture "/dev/input/eventX" [evtest-capture.xml] DESCRIPTION
evtest-capture captures the information and events from the input device specified on the command line and writes it to the xml file given. If no filename is given for the output file, evtest-capture.xml is chosen as default. evtest-capture needs to be able to read from the device; in most cases this means it must be run as root. Together with with evtest-create-device.xsl, a simple uinput-based software input device can be created that replays the events as if the same input was performed on the physical device. This can be useful to replicate bugs with input devices in upper layers of the stack. To convert evtest-capture.xml into such a uinput device, run: xsltproc evtest-create-device.xls evtest-capture.xml > mydevice.c gcc -o mydevice mydevice.c ./mydevice DIAGNOSTICS
If evtest-capture does not see any events even though the device is being used, the device may be grabbed by a process (EVIOCGRAB). This is usually the case when debugging a synaptics device from within X. VT switching to a TTY or shutting down the X server terminates this grab and synaptics devices can be debugged. SEE ALSO
evtest(1) AUTHOR
evtest-capture was written by Peter Hutterer <peter.hutterer@redhat.com[1]>. NOTES
1. peter.hutterer@redhat.com mailto:peter.hutterer@redhat.com 05/21/2012 EVTEST-CAPTURE(1)
All times are GMT -4. The time now is 07:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy