My input file is below
INPUT FILE
<ReconSummary>
<entryName>Total Deep</entryName>
<Code>777</Code>
<License>L</License>
<Tran>H20</Tran>
<job>1234</job>
</ReconSummary>
<ReconSummary>
<entryName>Total Saurav</entryName>
<Code>666</Code>
<License>L</License>
<Tran>H20</Tran>
<job>1234</job>
</ReconSummary>
I have code which looks like
LineNum=`grep -n "Deep" deep.xml | cut -d: -f 1 | awk -F '[\t]' '{$NF = $NF -1;}1'`
sed -i "/$LineNum/s/^/<!--/" deep.xml
What i need is:- i want to go to the line number which i am getting with LineNum variable and i want to add <!-- before an xml tag. So that my sample output looks like below
<!--<ReconSummary>
<entryName>Total Deep</entryName>
<Code>777</Code>
<License>L</License>
<Tran>H20</Tran>
<job>1234</job>
</ReconSummary>
<ReconSummary>
<entryName>Total Saurav</entryName>
<Code>666</Code>
<License>L</License>
<Tran>H20</Tran>
<job>1234</job>
</ReconSummary>
I am not able to do that. Can anyone tell what mistake i am doing in the code?