title: add filename to beginning of file using find and sed
body: <p>using the following I add the file name to the front of each line and send the output to a single file. </p>
  
  <pre><code>ls | while read file; do sed -e "s/^/$file/g" $file &gt; out; done
  </code></pre>
  
  <p>I want to perform the same <code>sed</code> replacement but using a <code>find</code> and <code>exec</code> or <code>xargs</code>  command - </p>
  
  <pre><code>find . -type f -exec sed "s/^/{}/g" {} &gt; out +
  </code></pre>
  
  <p>but I get an error - </p>
  
  <blockquote>
    <p>find: Only one instance of {} is supported with -exec ... +</p>
  </blockquote>
  
  <p>Input files are like this -</p>
  
  <p>fileA.txt</p>
  
  <pre><code>A1
  A2
  </code></pre>
  
  <p>fileB.txt</p>
  
  <pre><code>B1
  B2
  </code></pre>
  
  <p>desired output </p>
  
  <pre><code>fileA.txt A1
  fileA.txt A2
  fileB.txt B1
  fileB.txt B2
  </code></pre>
  
  <p><strong>I know how to do this with awk, but I'd like to do it with sed, find and exec or xargs.</strong></p>