I have the input XML file which looks like below
INPUT XML FILE
<Formula>
<Name>Total Hate Fee</Name>
<Code>1234>
<Job>BO</Job>
<Type>sub</Type>
</Formula>
<Formula>
<Name>Total BO Fee</Name>
<Code>1234>
<Job>BO</Job>
<Type>sub</Type>
</Formula>
<Formula>
<Name>Total BO Fee</Name>
<Code>1234>
<Job>BO</Job>
<Type>sub</Type>
</Formula>
I want my shell script to search the pattern "Total Hate Fee" and if the pattern is found then i would like to comment that particular line add <!--
and -->
just at the pattern match so that my output looks like below
OUTPUT XML FILE
<Formula>
<--<Name>Total Hate Fee</Name>-->
<Code>1234>
<Job>BO</Job>
<Type>sub</Type>
</Formula>
<Formula>
<Name>Total BO Fee</Name>
<Code>1234>
<Job>BO</Job>
<Type>sub</Type>
</Formula>
<Formula>
<Name>Total BO Fee</Name>
<Code>1234>
<Job>BO</Job>
<Type>sub</Type>
</Formula>
Can anyone help me out on this? Please note I do not want to use xmlstartet
tool. Instead I want to use shell scripting