title: unix sed and redirection
body: <p>I am trying to modify a file using sed in a linux server (Ubuntu 16.04).</p>
  
  <p>Here is an example of the code I am running:</p>
  
  <pre><code>sed 's/lineToChange/newString/' example.txt &gt; example.txt
  </code></pre>
  
  <p>I feel like I should see newString in example.txt after executing this command since the result of the sed command (which prints newString when executed by itself without the redirect) is redirected to overwrite the example.txt content.</p>
  
  <p>Unfortunately the file ends up empty when I do this...</p>
  
  <p>My common sense is telling me that this should be right but clearly there is something I just don't understand here.</p>