In this example I like to find XNAME where its value is equal to “US4” and assign US4 to $VAR1
I can do that using grep and “cut” and “tr” that is not a problem
The problem I have is that I need to find the section where this entry falls under The length of each section differs so are the entries within each section
So in example below once I grep for XAME where XNAME = US4 – I will need to find the section that it belongs to which is TNAME1 and assign TNAME1 to $VAR2
Thx
<TITLE name="TNAME1" publish="MOON">
<XNAME name="US1">
<PRINT> name="Merc1">
<PRINT> name="Merc3">
</XNAME>
<XNAME name="US2">
<PRINT> name="xert1">
<PRINT> name="xert2">
<PRINT> name="xert3">
</XNAME>
<XNAME name="US3">
<PRINT> name="yer1">
</XNAME>
<XNAME name="US4">
<PRINT> name="zer1">
</XNAME>
</TITLE>