title: Windows command line/shell - discarding the UTF-8 BOM
body: <p>This question is in continuation to <a href="https://stackoverflow.com/questions/12838802/windows-command-line-shell-while-appending-file-to-another-file-how-to-ignore/12838974">another question about selectively appending lines from one file to another</a>.</p>
  
  <p>The regex that I'm using works just fine at matching the lines to keep/to discard. The problem is that the file was composed from a bunch of other files, and sometimes the line I want to keep started out as the first line of a UTF-8 encoded file. This means that the <code>findstr</code> command returns something like:</p>
  
  <pre><code>∩╗┐LineToKeep that started out as the first line in its file
  LineToKeep another
  LineToKeep more lines
  ∩╗┐LineToKeep that started out as the first line in its file
  LineToKeep more
  </code></pre>
  
  <p>It's guaranteed that excepting the BOM bytes, the line will always begin with "LineToKeep". How can I get rid of those three UTF-8 BOM bytes, since these windows shell commands can't properly handle them?</p>
  
  <p>I'm hoping for a way to remove them in place, or perhaps a modification to the <code>findstr</code> command from that previous question.</p>
  
  <p>Since I know each line must begin with "LineToKeep" or "∩╗┐LineToKeep", I figure there's a way to compute something like <code>if (Line[3:10] == "LineToKeep") { Line = Line[3:]; }</code> for every line.</p>