title: How can I use a file in a command and redirect output to the same file without truncating it?
body: <p>Basically I want to take as input text from a file, remove a line from that file, and send the output back to the same file. Something along these lines if that makes it any clearer.</p>
  
  <pre><code>grep -v 'seg[0-9]\{1,\}\.[0-9]\{1\}' file_name &gt; file_name
  </code></pre>
  
  <p>however, when I do this I end up with a blank file.
  Any thoughts?</p>