I have a xml file attached. I need to parse parameterId and its value
My output should be like
151515 38
151522 32769
and so on..
Please help me. Its urgent
I have a xml file attached. I need to parse parameterId and its value
My output should be like
151515 38
151522 32769
and so on..
Please help me. Its urgent
Try this
perl -0ne 'print "$1 $2\n" while (/<parameterId>(\d+).*?<value>(\d+).*?/sg)' input
Output
151515 38
151522 32769
151510 1
151511 166
151519 13568
151514 0
151523 65535
151512 3
151521 32769
151520 65537
151513 0
11124 0
151524 18469
151525 0
23001 1
your xml file is present like below format ?
or all the tags in same line ?
<parameter>
<parameterId>151515</parameterId>
<value>38</value>
</parameter>
<parameter>
<parameterId>151515</parameterId>
<value>38</value>
</parameter>
I got the response from Jmeter tool. They are all in the same line.
---------- Post updated at 02:44 AM ---------- Previous update was at 02:43 AM ----------
Using perl command i do miss out 151517,151518 and 151516
I need all the parameters to get printed with values
I thougt only digits will come inside the tags.
Try this
perl -0ne 'print "$1 $2\n" while (/<parameterId>(\w+).*?<value>(\w+).*?/sg)' input
Or
$ nawk '{gsub(/<parameter>/,"\n<parameter>") && gsub(/<[^>]*>/," ");print}' input.txt|sed -e '/</d' -e '/^$/d'
151515 38
151522 32769
151510 ALCLA0A3F837
151517 1
151511 WILDCARD
151518 166
151519 13568
151514 0
151523 65535
151512 3FE50754ADAA01
151521 32769
151520 65537
151513 BVM4P10DRAI221EA
151516 0
11124 0
151524 18469
151525 0
23001 1
Thanks
Sha
I was going to provide you with an XSLT-based solution but found that your XMl document was not a valid document. It contains an embedded XML declaration - something that is not permitted in XML.