I have this bash loop below which uses perl script. It is expected to output something for every $i in every $f which I want to save as separate text file. The code I have below does the job, but instead of saving for individual $i, it saves for $f and puts the output of 18 to 24 in one file. May be I have to reposition the write command in this loop or is there a better way to do this?
for f in *.fastq; do
echo "Processing: " $f
for i in $(seq 18 24); do
echo "Doing: " $i
perl /home/owner/perl/count.pl $f $i
done > >(tee /media/owner/${f}_${i}.txt) 2>&1
done
perlcommand instead. Or create a{ group; }and redirect that