1. 创建脚本如 a.sh,内容:
#!/bin/bash
for ((i=1; i<=58; i++))
do
bsub -q serial -e temp$i.err -o temp$i.log "./regex -p temp$i --m --i"
done2. 修改权限
chmod u+x a.sh3. 执行 ./a.sh
4. 得到一系列结果文件,根据结果中的某行“final size: ”进行排序,使用shell文件 b.sh,内容如下:
#!/bin/bash
for ((i=1; i<=58; i++))
do
echo -n $i " " ; grep "final size" temp$i.err
done
执行./b.sh: ./b.sh> entries
5. 接下来根据entries中的第四列进行排序:
sort -n -k 4 entries | awk "{printf $1, $4}" > sorted_entries
6. 根据排序后的文件跑程序,建立 c.sh ,内容如下:
list=(9 14 39 44 45 16 28 3 7 21 42 38 22 54 4 32 33 23 37 10 30 5 41 35
36 40 43 19 11 31 34 51 53 18 55 58 8 15 20 56 29 6 48 47 57 46 49 52 13
1 26 25 27 2 12 24 50 17)
for ((i=2; i<=58; i++))
do
printf "bsub -q serial -e ttrend_$i.err -o ttrend_$i.log \"./regex -pm $i "
for ((j=0; j
do
printf "temp%d " "${list[$j]}"
done
printf " --m --i\";"
echo
donelist是排好序的文件名。
7. 执行c.sh:./c.sh > tempbatch.sh
8. 给tempbatch.sh加上shell头 #!/bin/bash
执行tempbatch.sh,从而最终提交批处理任务。