Hi I have an xml
file. I want to add the following tags when I see the tag. For example
I want to add
<Context
allowLinking="false"
privileged="false"
useHttpOnly="true"
xmlValidation="false">
</Context>
The file looks like this
<Context>
</Context>
After adding it should like this
<Context allowLinking="false"
privileged="false"
useHttpOnly="true"
xmlValidation="false">
</Context>
I used the following sed command but I am not able to add the parameters inside the tag as shown above
I tried the following sed
grep 'allowLinking' /bao/tomcat/conf/context.xml
if [ $? -ne 0 ]
then
sed -i '/<Context .*?>/i allowLinking="false" \n privileged="false" \n useHttpOnly="true" \n xmlValidation="false"/' /tmp/context.xml
fi
Could you please let me know how to add the contents.
Thanks Dinesh