title: Split file by keyword
body: <p>In my job we use EDI UNIFACT,and I´m tring to import these messages.
  I´m using an open source library that accepts a file (streamreader) and maps the info, the problem is that some of the files I receive don´t have the correct format for this library.</p>
  <p>Each message starts at UNB ..., and end on UNZ ...</p>
  <pre><code>UNB+UNOA:2+
  UNH+1+CODECO
  .........
  UNT+19+1'
  UNZ+1+144427'
  ------------------&gt; I need to separate here 
  UNB+UNOA:2+
  UNH+1+CODECO
  .......
  UNT+19+1'
  UNZ+1+144427'
  .....
  </code></pre>
  <p>I already use a streamreader to search for an word, and then reset it.</p>
  <pre><code>foreach (string filename in Directory.GetFiles(path))
  {
    using (var stream = new StreamReader(filename))
    {
      while (!stream.EndOfStream)
      {
        var line = stream.ReadLine();
        if (line.Contains(@&quot;CODECO&quot;)) //Codeco
        {
          stream.DiscardBufferedData();
          stream.BaseStream.Seek(0, System.IO.SeekOrigin.Begin);
          var grammar_read = EdiGrammar.NewEdiFact();
          var interchange = default(Interchange&lt;CODECO_D95B&gt;);
          interchange = new EdiSerializer().Deserialize&lt;Interchange&lt;CODECO_D95B&gt;&gt;(stream, grammar_read);
          if (interchange != null)
            list.AddRange(ImportCODECO(interchange));               
         }
      }
   }             
  </code></pre>
  <p>My question is, split these files, so I can input each chunk off information separately as it came from a file?</p>
  <p>Many thanks</p>