I have a xml file having structure something like below:
<role name="test" pattern=".*">
<assignedSIDs>
<sid>abc</sid>
<sid>cde</sid>
<sid>def</sid>
</assignedSIDs>
</role>
<role name="test1" pattern=".*">
<assignedSIDs>
<sid>abc</sid>
<sid>zxc</sid>
<sid>vbn</sid>
</assignedSIDs>
</role>
<role name="test2" pattern=".*">
<assignedSIDs>
<sid>abc</sid>
<sid>hex</sid>
<sid>oct</sid>
</assignedSIDs>
</role>
I want to find role
tag name attribute based on value of sid
tag.
for eg: if I search for abc
, the query must return test, test1
and test2
I referred this below link and got half of the solution .
XMLStarlet Return attribute based on value (Reverse lookup)
I also refered this too
http://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html
but I didn't got any example that would support my requirement.
Is there something I can do?