I want to run a script on all the files in a folder like this:
sh script.sh *.fasta > output
however I want the outputs to be in individual files for every input. So instead of getting 5 files through the command and putting them all into a file called "output" is there a way to have the outputs be the name of the file with a suffix at the end like "_output"?
So if I had 3 files like:
file1.fasta file2.fasta file3.fasta
Is there a way I could run a command like this:
sh script.sh *.fasta
and output the new files like this for each input:
file1_new.fasta file2_new.fasta file3_new.fasta
I tried the command:
sh script.sh *.fasta > *_output.fasta
But it didn't work, I also tried assigning all the files of interest to a variable like this, with he idea that maybe I could somehow rename the outputs if I first assigned them to a variable:
But that didn't work either. I don't know what to call this question, so sorry if it's been asked already! How do I run several files through a command and have a new output for each input?