title: How to edit a file descriptor in place with sed
body: <p>I succeeded in using a file descriptor with sed and giving the result on the standard output. Giving a file "file.txt" containing :</p>
  
  <pre><code>$ cat file.txt
  foo
  Foo
  </code></pre>
  
  <p>I open a file descriptor to file.txt, open a sub-shell, and give this file descriptor to sed :</p>
  
  <pre><code>$ (sed "/Foo/c\\bar" &lt;&amp;9 ) 9&lt; file.txt
  foo
  bar
  </code></pre>
  
  <p>The result is correct.</p>
  
  <p>Now, if I want to use the -i option of sed to change in place, I have troubles. I open the file descriptor in read and write mode, then give it to sed as input file :</p>
  
  <pre><code>$ (sed -i "/Foo/c\\bar" &lt;&amp;9 ) 9&lt;&gt; file.txt
  sed: no input file
  </code></pre>
  
  <p>I do not understand why an input file is missing. Maybe sed needs a filename, and not a file descriptor when using the -i option ?</p>
  
  <p>I tried a workaround which, of course, does not work as expected :</p>
  
  <pre><code>$ (sed "/Foo/c\\bar" &lt;&amp;9 &gt;&amp;9 ) 9&lt;&gt; file.txt
  $ cat file.txt
  foo
  Foo
  foo
  bar
  </code></pre>
  
  <p>while I expected :</p>
  
  <pre><code>$ cat file.txt
  foo
  bar
  </code></pre>
  
  <p>Thanks in advance for your help !
  Dunatotatos</p>