I have a series of files in sub-directories that I want to loop through, process, and name according to the input filename and the various parameters (models) I'm using to process the files.
For example file names like AG005574, AG004788, AG003854 and parameter/model values like ATd, PZa, RTK1, so I want to end with files like AG005574_ATd AG005574_PZa AG005574_RTK1 AG004788_ATd AG004788_PZa etc. I loop through the subfolders, run the process and output the results like so:
#!/usr/bin/bash
model=$1
for file in $(find /path/to/files/*/ -type f -name 'AG*.fa');
do output=${model}"_"${file} ;
process_call --out=$output."tab" --options ../Path/to/model/$1.hmm $file ;
echo $file
done
I want to be able to specify the model on the command-line (hence the model=$1). However, my approach does not work in general; I can get the output named by model using
do output=$model ;
but this also writes only the last file processed because it over-writes all the others (and no input filename is used). Any help/tutoring is much appreciated.
output=${model}"_"${file}withoutput="${model}_${file}". Those are general observations, not answers to your question.