Check occurence of two consecutive XML tag in Unix Shell



I have the following XML File:



<PARENT_TAG>
<CHILD_TAG>
<DETAIL_1_TAG></DETAIL_1_TAG>
<DETAIL_2_TAG></DETAIL_2_TAG>
<DETAIL_3_TAG></DETAIL_3_TAG>
<DETAIL_4_TAG></DETAIL_4_TAG>
</CHILD_TAG>
</PARENT_TAG>


which can be formatted even as



<PARENT_TAG><CHILD_TAG><DETAIL_1_TAG> ... </CHILD_TAG></PARENT_TAG>


I would like to extract the name of the xml tag following using grep,awk,sed. In this case, I would extract "CHILD_TAG".


No comments:

Post a Comment