Hi ,
I have an xml format as shown below:
<Info>
<last name="sean" first name="john"/>
<period="5" time="11"/>
<test value="1",test2 value="2",test3 value="3",test4 value="5">
<old>
<value1>1</value1>
<value2>2</value2>
</old>
<new>
<value1>4</value1>
<value2>3</value2>
</new>
<total>12</total>
</Info>
<Info>
<last name="sean" first name="micheal"/>
<period="10" time="20"/>
<test value="7",test2 value="8",test3 value="9",test4 value="10">
<old>
<value1>8</value1>
<value2>7</value2>
</old>
<new>
<value1>6</value1>
<value2>5</value2>
</new>
<total>20</total>
</Info>
output that i need is:
firstname,period,time,test_value,test3_value,test4_value,old_value1,old_value2,new_value1, new_value2,total
john,5,11,1,3,4,1,2,4,3,12
micheal,7,9,10,8,7,6,5,20
I just now how to parse <total>20</total> by using this
nawk 'BEGIN{FS="[<|>]"}
/<total>/ {printf(" %s\n"$3)}'
However, i do have have any ides on how to parse the rest of the file.
Anyone can know about that?
Your help is highly appreciated.
Thanks!