Andrés Parada Andrés Parada - 1 year ago 52
Perl Question

for loop calling two different files (same name, different extension) across several files

I have several files. I need to run a perl script calling all the files in a folder, simultaneously calling one file with extension .pep and another that is a similar file and matches the same name but different extension, .pep.nuc (like


I have this script so far, but I am missing something of course.

for file *.pep; do ./ *.pep *.pep.nuc > "${file%.*}.nucleo"; done

Answer Source

This should do it:

for file in *.pep; do
    ./  "$file" "${file}.nuc" > "${file%.pep}.nucleo";