I am executing the following script using 'awk -f process.awk out' where 'out' is the input file which consists of 5000 sequences. Each time it takes one sequence, run the below program by creating a directory, run the mfold command within that directory, running another shell script 'final5' and redirect the output to a file from final5 shell. After that the directory is deleted, taking second sequence from 'out' and repeating this process. It is working well upto 1020 directories. From 1021 it is giving error. After executing this 1000 times, can we reset the counter to 1 in such a way it takes it as directory 1 and start this process for 1001 to 2000 sequences. Similarly I have to reset the counter to five times because input file contains 5000 seqeunces. Shell scripting for this is highly appreciated. Thanks in advance.
Code:
process. awk
BEGIN {
FS=">";RS=">";ORS="";
}
$NF { d++
system("mkdir dir"d);
print ">"$0 > ("dir"d"/input");
system("cd dir"d"; mfold SEQ=input");
system("cd dir"d"; /home/rsankar/bin/mfold SEQ=input");
system(cd "/home/rsankar/rna/temp");
system("sh final5");
system("rm -rf dir"d);