I have a xml file with data like below

```
<temp>
<a="something" total="50" b="something" total="0" c="something" total="20">
</temp>

```

I need to get first value of total i.e, 50 but my sed solution is giving value of last occurrence of total i.e, 20

```
sed -n 's/.*total="\([^"]*\).*/\1/p' temp.xml

```

output : 20

desired output: 50

I appreciate the help. Thank you