title: Deleting a multiline block of text between regex pattern using sed
body: <p>I have a duplicated block of text I need to delete in a large xml file.  I want to keep the first block and delete the second all within the same xml tag.  For example:</p>
  
  <pre><code>&lt;!--#if--&gt; 
   -- several lines of text
  &lt;!--#else--&gt;
  -- several lines of the same text
  &lt;!--#endif--&gt;
  </code></pre>
  
  <p>I'd like to delete the second block between the else and endif, and keep the keep the block between the if and else tags.  Any help much appreciated - the script ends up deleting the entire file.</p>
  
  <pre><code>sed -i '/^&lt;!--#else--&gt;/ {p; :a; N; /^\&lt;\!--\#endif--\&gt;/!ba; s/*.\n//}; d' test.xml
  </code></pre>