title: how to use the name of the input file in sed replace
body: <p>i have several files in which i want to replace a certain word with the name of the file itself..</p>
  
  <p>for example i have 2 files named test1.txt  and test2.txt</p>
  
  <p>both files are equal and  look like </p>
  
  <pre>
  bla1,bla2,temp
  bla2,bla3,temp
  </pre>
  
  <p>with the sed i want to replace the word temp   with the name of the file itself</p>
  
  <p>so after the sed operation i have 2 different files </p>
  
  <p>test1.txt , which looks like :</p>
  
  <pre>
  bla1,bla2,test1
  bla2,bla3,test1
  </pre>
  
  <p>test2.txt,  which looks like : </p>
  
  <pre>
  bla1,bla2,test2
  bla2,bla3,test2
  </pre>
  
  <p>so my question ... how do i use the actual name of the input file itself  as part of the replace command?</p>
  
  <pre><code>sed "s/temp/  ??filename??/   ???  "    *.txt
  </code></pre>
  
  <p>thanks for your suggestions</p>