title: insert a line to a specific position in multiple files
body: <p>I am looking for a way to insert a line to a specific position in a file.</p>
  
  <p>Kinda like this: <a href="http://www.garron.me/en/linux/add-line-to-specific-position-in-file-linux.html" rel="nofollow">using sed</a></p>
  
  <p>But the problem is, i want to write the output into the same file where i get the input and i need to do it with more than one file.</p>
  
  <p>sadly this does not work: <code>sed '3iline 3' input.txt &gt; input.txt</code></p>
  
  <p>this would work: <code>sed '3iline 3' input.txt &gt; tmp.txt &amp;&amp; cat tmp.txt &gt; input.txt</code></p>
  
  <p>but i doesn't work with find and exec anymore...</p>
  
  <p>i hoped something like this would be possible:</p>
  
  <pre><code>find /usr/local/share/ -iname 'xyz.htm' -exec sed '19i&lt;p&gt;TEXT&lt;/p&gt;' {} &gt; {} \;
  </code></pre>
  
  <p>but it doesn't work like this, so i ended up writing a short script which worked. But it still bothers me, because i keep thinking it should be possible to do it short (maybe onliner) and easy.</p>
  
  <p>I hope someone can point me in the right direction.</p>