title: Find and replace in file and overwrite file doesn't work, it empties the file
body: <p>I would like to run a find and replace on an HTML file through the command line.</p>
  
  <p>My command looks something like this:</p>
  
  <pre><code>sed -e s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g index.html &gt; index.html
  </code></pre>
  
  <p>When I run this and look at the file afterward, it is empty. It deleted the contents of my file.</p>
  
  <p>When I run this after restoring the file again:</p>
  
  <pre><code>sed -e s/STRING_TO_REPLACE/STRING_TO_REPLACE_IT/g index.html
  </code></pre>
  
  <p>The <code>stdout</code> is the contents of the file, and the find and replace has been executed.</p>
  
  <p>Why is this happening?</p>