Need to take inputs from a file,then search that set of content from a XML file.In below sample file need to take input (John,MANG,102) from serch_file.txt,then need to search that combination each record H> to /H>) if found need to take the ADR> to /ADR> content from that record(H> to /H>) and write into the output.txt file.
INPUT FILE
serch_file.txt
John,MANG,102
XML FILE
XML_file.xml
<H>
<NAM>John</NAM>
<DEG>DEV</DEG>
<ID>100</ID>
<ADR>
HOME 1,USA
Pin-12345
</ADR>
</H>
<H>
<NAM>John</NAM>
<DEG>ANALIST</DEG>
<ID>101</ID>
<ADR>
HOME 3,USA
Pin-12345
</ADR>
</H>
<H>
<NAM>John</NAM>
<DEG>MANG</DEG>
<ID>102</ID>
<ADR>
HOME 2,UK
Pin-54321
</ADR>
</H>
OUT PUT FILE
output.txt
John,MANG,102
HOME 2,UK
Pin-54321
My Work
IFS=,
while read name deg id
do
cat XML_file.xml
--here difficult to check that combination to each 3 <H> to </H> record
> output.txt
done < serch_file.txt