title: Remove multi-line strings from a text file using a batch script
body: <p>I am trying to create a batch file that will edit a text file to remove lines that contain a certain string <b>and</b> remove the line directly after that.
  An example of this file would look like this:</p>
  
  <pre>
  LINE ENTRY KEEP_1 BLA BLA
  END
  LINE ENTRY REMOVE_1 FOO BAR
  END
  LINE ENTRY REMOVE_2 HELLO WORLD
  END
  LINE ENTRY KEEP_2 CAT DOG
  END
  </pre>
  
  <p>After running the batch script I require the new file to contain</p>
  
  <pre>
  LINE ENTRY KEEP_1 BLA BLA
  END
  LINE ENTRY KEEP_2 CAT DOG
  END
  </pre>
  
  <p>where any line containing REMOVE_ has been deleted, as well as the corresponding 'END' line.</p>
  
  <p>I have tried using the technique found <a href="https://stackoverflow.com/questions/418916/delete-certain-lines-in-a-txt-file-via-a-batch-file">here</a> to remove the lines containing the string but it does not appear to be possible to include characters such as \r\n to check for and include the 'END' in the search. I can't do this as 2 seperate FINDSTR commands as I still require the 'END' text to be kept for the other two entries.<br/>
  Using <code>findstr /v REMOVE_</code> leaves me with the following:</p>
  
  <pre>
  LINE ENTRY KEEP_1 BLA BLA
  END
  END
  END
  LINE ENTRY KEEP_2 CAT DOG
  END
  </pre>
  
  <p>and using <code>findstr /v "REMOVE_*\r\nEnd"</code> does not seem to work at all.
  Just to confirm each line is definitely terminated with <code>\r\n</code>.</p>
  
  <p>Any help on this issue would be greatly appreciated.</p>