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
GEARMAN_TASK_ST(3)						     Gearmand							GEARMAN_TASK_ST(3)

NAME
gearman_task_st - Gearmand Documentation, http://gearman.info/ SYNOPSIS
#include <libgearman/gearman.h> gearman_task_st void gearman_task_free(gearman_task_st *task) void *gearman_task_context(const gearman_task_st *task) void gearman_task_set_context(gearman_task_st *task, void *context) const char *gearman_task_function_name(const gearman_task_st *task) const char *gearman_task_unique(const gearman_task_st *task) const char *gearman_task_job_handle(const gearman_task_st *task) bool gearman_task_is_known(const gearman_task_st *task) bool gearman_task_is_running(const gearman_task_st *task) uint32_t gearman_task_numerator(const gearman_task_st *task) uint32_t gearman_task_denominator(const gearman_task_st *task) void gearman_task_give_workload(gearman_task_st *task, const void *workload, size_t workload_size) size_t gearman_task_send_workload(gearman_task_st *task, const void *workload, size_t workload_size, gearman_return_t *ret_ptr) const void *gearman_task_data(const gearman_task_st *task) size_t gearman_task_data_size(const gearman_task_st *task) void *gearman_task_take_data(gearman_task_st *task, size_t *data_size) size_t gearman_task_recv_data(gearman_task_st *task, void *data, size_t data_size, gearman_return_t *ret_ptr) const char *gearman_task_error(const gearman_task_st *task) New in version 0.21. gearman_return_t gearman_task_return(const gearman_task_st *task) New in version 0.21. Link with -lgearman DESCRIPTION
A gearman_task_st represents a task. Work that is sent by a client to a gearman server is seen as a task (a worker recieves a task in the form of a job. Tasks, i.e. gearman_task_st are created by calling either gearman_execute(), gearman_client_add_task(), or gearman_client_add_task_back- ground(). gearman_client_add_task_status() can also create gearman_task_st, these tasks will be used to monitor a previously created gearman_task_st. gearman_task_free() is used to free a task. This only needs to be done if a task was created with a preallocated structure or if you want to clean up the memory of a specific task. gearman_task_set_context() sets the given context of the gearman_task_st. The context can be used to pass information to a gearman_task_st. gearman_task_context() returns the context that was used in the creation of the gearman_task_st (or that was set with gearman_task_set_context(). gearman_task_data() returns the current data that has been returned to the task. gearman_task_data_size() will give you the size of the value. gearman_task_take_data() is the same as gearman_task_data() but the value that is returned must be freed by the client (free(3)). gearman_task_recv_data() can be used with pre-allocated buffers. gearman_task_is_known(), gearman_task_is_running(), gearman_task_numerator(), and gearman_task_denominator(), return values related to the last status update that was made to the gearman_task_st. They do not cause the gearman_task_st to update itself. gearman_task_error() return the last error message that the gearman_task_st encountered. gearman_task_return() return the last gear- man_return_t stored. A value of GEARMAN_UNKNOWN_STATE means that the task has not been submitted to server yet, or that no function was available if the job has been submitted. RETURN VALUE
Various. Values that are returned by gearman_task_take_data() must have free(3) called on them. HOME
To find out more information please check: http://gearman.info/ SEE ALSO
gearmand(8) libgearman(3) AUTHOR
Data Differential http://www.datadifferential.com/ COPYRIGHT
2012, Data Differential, http://www.datadifferential.com/ 0.33 May 04, 2012 GEARMAN_TASK_ST(3)
All times are GMT -4. The time now is 02:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy