title: Performing regex capture and then substitute using SED/PERL
body: <p>I have a data that looks like this (let's call this file <code>submit.txt</code>):</p>
  
  <pre><code>dir1/pmid_5409464.txt
  dir1/pmid_5788247.txt
  dir1/pmid_4971884.txt
  </code></pre>
  
  <p>What I want to do is to perform an inline file regex change
  so that it results in the following</p>
  
  <pre><code>perl mycode.pl /home/neversaint/dir1/pmid_5409464.txt &gt; /home/neversaint/dir1/pmid_5409464.output
  perl mycode.pl/home/neversaint/dir1/pmid_5788247.txt &gt; /home/neversaint/dir1/pmid_5788247.output
  perl mycode.pl /home/neversaint/dir1/pmid_4971884.txt &gt; /home/neversaint/dir1/pmid_4971884.output
  </code></pre>
  
  <p>Is there a SED/Perl one liner to do that?</p>
  
  <p>My difficulty is in capturing the input file name and then
  create the output file (<code>.output</code>) - for each line - based on that. I'm stuck with this:</p>
  
  <pre><code>sed 's/^/perl mycode.pl \/home\/neversaint\/dir1\//g' submit.txt |
  sed 's/$/ &gt;/'
  </code></pre>