LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   reset the counter in shell script. (https://www.linuxquestions.org/questions/linux-newbie-8/reset-the-counter-in-shell-script-848251/)

kswapnadevi 12-03-2010 09:10 PM

reset the counter in shell script.
 
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);


catkin 12-03-2010 11:11 PM

Hasn't grail already suggested a solution to this problem?

BTW the posted awk is incomplete.

grail 12-04-2010 01:46 AM

For this one I would wonder why you are bothering to use awk at all seeing everything you wish to do except read the line from the file requires
you to jump out to the system??


All times are GMT -5. The time now is 02:38 PM.