I have an XML file (config.xml) as below.
<?xml version="1.1" encoding="UTF-8"?>
  <project>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
   <triggers>
    <com.cloudbees.jenkins.GitHubPushTrigger plugin="github@1.29.2">
      <spec/>
    </com.cloudbees.jenkins.GitHubPushTrigger>
   </triggers>
   <concurrentBuild>false</concurrentBuild>
  </project>
I want to replace the triggers block with only <triggers/>. But when I use SED to do it, I get this error:
sed: 1: "/<triggers>/{:a;N;/<\/t ...": unexpected EOF (pending }'s)
Command:
sed -i '.bak' '/<triggers>/{:a;N;/<\/triggers>/!ba;N;s/.*\n/<triggers\/>\n/};p' config.yml
I want you to know what am I missing here and how to get the desired outcome?
Desired Output:
<?xml version="1.1" encoding="UTF-8"?>
<project>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
</triggers>
<concurrentBuild>false</concurrentBuild>
</project>
 
    