I have an XML file which contains below
<SummaryRecordMapping>
<eName>Licensed Original MC TPE EXCESSIVE AUTH</eName>
<jobs>
<job>
<SummaryRecordMapping>
<eName>Licensed Reversal MC TPE EXCESSIVE AUTH</eName>
<jobs>
<job>
where, <eName>Licensed Original, </eName> , <eName>Licensed Reversal are static.
I want output like below
<SummaryRecordMapping>
<eName>Licensed Original MC This is New Deep</eName>
<jobs>
<job>
<SummaryRecordMapping>
<eName>Licensed Reversal MC This is New Deep</eName>
<jobs>
<job>
<SummaryRecordMapping>
<eName>Licensed Original MC This is Mayurika</eName>
<jobs>
<job>
<SummaryRecordMapping>
<eName>Licensed Reversal MC This is Mayurika</eName>
<jobs>
<job>
Below is my code
#!/bin/bash
while read whole_line ;
do
name=`echo "$whole_line" | awk '{$1=""; print}'`
LO="<eName>Licensed Original MC ${name}</eName>"
awk -v diff="$LO" '{ if(NR==2) { print diff}
else {print $0} } ' southBalanceRecon.xml >>LO.xml
LR="<eName>Licensed Reversal MC ${name}</eName>"
awk -v diff="$LR" '{ if(NR==14) { print diff}
else {print $0} } ' LO.xml >> LR.xml
done < file.txt
My file.txt contains below
C71 This is New Deep
C72 This is Mayurika
When I am trying to run my code I am not getting the probable output which I mentioned above. Can anyone tell me what is wrong with my code?