title: Remove duplicate lines and overwrite file in same command
body: <p>I'm trying to remove duplicate lines from a file and update the file. For some reason I have to write it to a new file and replace it. Is this the only way?</p>
  
  <pre><code>awk '!seen[$0]++' .gitignore &gt; .gitignore
  
  awk '!seen[$0]++' .gitignore &gt; .gitignore_new &amp;&amp; mv .gitignore_new .gitignore
  </code></pre>