title: How to substitute without creating intermediate file in sed?
body: <p>I was doing some hands-on with the Unix <code>sed</code> command. I was trying out the substitution and append command, in a file. But the difficulty is, I have to create an intermediate file, and then do <code>mv</code> to rename it to the original file.</p>
  
  <p>Is there any way to do it at one shot in the same file?</p>
  
  <pre><code>[root@dhcppc0 practice]# sed '1i\
   &gt; Today is Sunday
   &gt; ' file1 &gt; file1
  
  [root@dhcppc0 practice]# cat file1
  [root@dhcppc0 practice]#
  </code></pre>
  
  <p>The file is deleted!</p>
  
  <pre><code>[root@dhcppc0 practice]# sed 's/director/painter/' file1 &gt; file1
  [root@dhcppc0 practice]# cat file1
  </code></pre>
  
  <p>The file is deleted!</p>