title: split file into multiple files based upon differing start and end delimiter
body: <p>i have a file that i need split into multiple files, and need it done via separate start and end delimiters.</p>
  
  <p>for example, if i have the following file:</p>
  
  <pre><code>abcdef
  START
  ghijklm
  nopqrst
  END
  uvwxyz
  START
  abcdef
  ghijklm
  nopqrs
  END
  START
  tuvwxyz
  END
  </code></pre>
  
  <p>i need 3 separate files of:</p>
  
  <p>file1</p>
  
  <pre><code>START
  ghijklm
  nopqrst
  END
  </code></pre>
  
  <p>file2</p>
  
  <pre><code>START
  abcdef
  ghijklm
  nopqrs
  END
  </code></pre>
  
  <p>file3</p>
  
  <pre><code>START
  tuvwxyz
  END
  </code></pre>
  
  <p>i found <a href="https://stackoverflow.com/questions/1825745/split-file-based-on-string-delimiter-in-bash-how" title="link using awk">this</a> link which showed how to do it with a starting delimiter, but i also need an ending delimiter.  i have tried this using some regex in the awk command, but am not getting the result that i want.  i don't quite understand how to get awk to be 'lazy' or 'non greedy', so that i can get it to pull apart the file correctly.</p>
  
  <p>i really like the awk solution.  something similar would be fantastic (i am reposting the solution here so you don't have to click through: </p>
  
  <p><code>awk '/DELIMITER_HERE/{n++}{print &gt;"out" n ".txt" }' input_file.txt</code></p>
  
  <p>any help is appreciated.</p>