reading xml attributes with shell script

Hi,

Iam new to shell scripting.I have below urgent requirement

I want to read attributes (transaction,documentmode) in xml tag with shell scripting and create a filename with these attribues

Xml :
<PURCHASE_10 partner="food" version="1.50" timestamp="2009-03-10T09:56:55" transaction="PURCHASEORDER" document_mode="abc">
</PURCHASE_10>

output : PURCHASEORDER_abc.xml

Ur help is appreciated

Thanks.

Hi ,

touch `sed -n 's/.*transaction="\(.*\)" document_mode="\(.*\)">/\1_\2.txt/p' Input_file.txt`

Don't post like ".I have below urgent requirement".

while(<DATA>){
	if(/.*transaction="([^"]*)".*document_mode="([^"]*)".*/){
		print "$1_$2.xml\n";
	}
}
__DATA__
<PURCHASE_10 partner="food" version="1.50" timestamp="2009-03-10T09:56:55" transaction="PURCHASEORDER" document_mode="abc"> 
</PURCHASE_10> 

Thanks a lot panyam.Its working as expected.

-----Post Update-----

Hi

How to capture the xml tag attribute value into a variable in shell script.

Thanks,
Sumi

-----Post Update-----

Hi

How to capture the xml tag attribute value into a variable in shell script.

Thanks,
Sumi

-----Post Update-----

Hi,

How to capture the xml tag attribute value into variable in shell script?

Thanks,
Sumi