I am looking to remove "error_mail" and "succeed_mail" nodes from multiple similar XML files using sed or awk utilities .
Using sed , I was trying with below command ..but its not working
sed -i /<action name="succeed_mail">/,/<\/action>/d *.xml
Here is the sample file (test.xml) looks as below:-
Input XML File :- test.xml
<workflow>
<action name="start"
-----
-----
</action>
<action name="error_mail">
<email xmlns="uri:oozie:email-action:0.1">
<to>abc@xyz.com</to>
<cc>abc@xyz.com</cc>
<subject>Batch Failed</subject>
<body>Batch Failed at ${node}</body>
</email>
<ok to="killjob"/>
<error to="killjob"/>
</action>
<action name="succeed_mail">
<email xmlns="uri:oozie:email-action:0.1">
<to>abc@xyz.com</to>
<cc>abc@xyz.com</cc>
<subject>Batch Succeed</subject>
<body>Batch completed</body>
</email>
<ok to="end"/>
<error to="end"/>
</action></r>
</workflow>
--------Desired output :-
test.xml
<workflow>
<action name="start"
-----
-----
</action>
</workflow>