I want to add an attribute to every tag in my xml, which is incrementing using either awk, sed, perl or plain shell cmd
For Eg:
<tag1 key="123">
<tag2 abc="xf d"/>
<tag3 def="d2 32">
</tag3>
</tag1>
I am expecting the following output
<tag1 key="123" order="1">
<tag2 abc="xf d" order="2"/>
<tag3 def="d2 32" order="3">
</tag3>
</tag1>
If possible I am not looking on any dependencies(Twig,LibXML), pure string manipulation.