![]() |
shell scripting for accepting input from different directories automatically
The two shell scripts (t1prog and t2prog) are given below they are working fine. The input for the first program is 't1.det' and for second program is 't1.rnaml'. These two input files are in 'dir1' folder. I am executing the shell like 'sh t1prog > t1out' and 'sh t2prog > t2out' from this directory only. Then I am executing a java program 'java RNA'; for this, t1out and t2out are input files used in the program and I am getting the final output on screen.
The input files 't1.det' and 't1.rnaml' are in different folders with same name and with different values. Each folder specifies one gene sequence input files. In mfold directory there are 5 directors and each directory contains these input files as shown below cd mfold dir1 dir2 dir3 dir4 dir5 cd dir1 t1.det t1.rnaml ----- cd dir5 t1.det t1.rnaml I requesting you to please help me in shell script to automate this process like t1prog and t2prog first take the inputs from dir1 folder, run the shell and redirect the output to t1out and t2out and after executing the java program with statment 'java RNA' the output will be redirected to a file like 'RNAout1'. Then takes the inputs from dir2 folder, same process again, and redirect the output to 'RNAout2'. Like this for all inputs values from 5 folders. Modify the two shell scripts given below, to accept the inputs in that way. shell 1: t1prog 1. #!/bin/bash 2. PrintVal() { C=${C#*(}; C=${C%)*}; echo $C | sed 's/).*( /-/'; } 3. while IFS=':=' read A B C 4. do 5. case $(echo $A) in 6. Initial*) 7. ((NotFirst)) && { echo; echo; } || NotFirst=1 8. echo ${B#* }; echo 9. Hairpins=0 10. ;; 11. 12. Hairpin*) 13. ((Hairpins==0)) && echo "$A:" 14. PrintVal 15. ((Hairpins++)) 16. ;; 17. Multi-loop) 18. echo "$A:" 19. PrintVal 20. ;; 21. esac 22. done <t1.det shell 2: t2prog #!/bin/sh i=1 while read line do freecount=`echo "${line}" | grep -i "free" | wc -l` poscount=`echo "${line}" | grep -i "position" | wc -l` if [ $freecount -eq 1 ] then rangeoutput=0 else rangeoutput=1 fi if [ $rangeoutput -eq 0 ] then value=`echo "${line}" | sed -n 's/<.*>\(.*\)<.*>/\1/p'` echo $value else if [ $poscount -eq 1 ] then pvalue[$i]=`echo "${line}" | sed -n 's/<.*>\(.*\)<.*>/\1/p'` if [ $i -eq 2 ] then echo "${pvalue[1]} - ${pvalue[2]}" i=0 fi i=`expr $i + 1` fi fi done <t1.rnaml ----------------------------- for one input in dir1 i am executing like this sh t1prog > t1out sh t2prog > t2out java RNA for inputs in different directories and executing these and redirecting the final ouput after executing 'java RNA' statement to a file is needed. PLS. KINDLY HELP ME WHICH IS VERY ESSENTAIL FOR ME. THANKING YOU |
Duplicate post reported. Earlier post is http://www.linuxquestions.org/questi...orires-842660/
|
Please follow the discussion in the original thread.
|
| All times are GMT -5. The time now is 04:07 AM. |