Question : extract certain xml nodes from bash script and write them to a file

hello.

for a bash script I am writing, I need to take take the parameters from 1 or more effects in an xml file and write those parameters in separate files (one per effect).

For example, in the xml file attached, I have two effects (one ..... , one ....

I tried something like
EFFECT_1_PARAMETER=`cat my_xml_file | perl -pi -e 's@.*(.*)fectStack>@$1@g' but it does not work and does not enable me to loop through effects in the xml to write each of them to a separate file.


Could anybody help ?
I'm using linux centos 4, and cannot install anything : I would like the script to work straight out of the box.

thanks a lot
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:

    
    
        bee4f29a-4b45-431f-b757-609d6644ca5c
        
            bee4f29a-4b45-431f-b757-609d6644ca5c
            Stack 1
            
                Fri Sep 26 02:59:35 2008
                Fri Sep 26 02:59:35 2008
                0
                2
[......]
                    1 1
                    0
                    2
                    9.64506e-06
                    255 255 0
                
                9ab1f049-a190-4ed9-89f0-b8cfcc414a30
                608d1c96-0cc1-482f-b343-a228d4e6bfce
            
            
                Thu Sep 18 12:59:33 2008
                Thu Sep 18 13:17:37 2008
                
                    1
[...]
                    1
                    7 7
                
            
        
    
    0270bcd7-6f7f-4aca-947f-98b7ddf11bd8
Open in New Window Select All

Answer : extract certain xml nodes from bash script and write them to a file

This will create an out#.xml, where # starts at 1 for the first pair, and increments for each one.

perl -e 'local $/;$_=<>;s|()|$count++;open(OUT,">out$count");print OUT "$1\n";close($o)|gse;' file.xml
Random Solutions  
 
programming4us programming4us