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