在shell脚本文件中多次唤醒

时间:2014-09-08 08:02:05

标签: memory awk size cluster-computing slurm

我正在将一个批处理文件发送到一个slurm集群,该集群会对相同infile的字段进行awks并附加到输出。前几行有效,但突然间它就死了。它在第二次回响之前就消失了。如果有人调试或向我展示一个更好的脚本会很好,但我想知道为什么(或者如果)bash文件在一遍又一遍地做同样的工作时会崩溃。

#!/bin/bash
#SBATCH -A b2014091
#SBATCH -p core
#SBATCH -n 1
#SBATCH -t 23:00:00
#SBATCH -J sbatch

#input was MK...vcf

input=$1

output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="1/1") && (substr($15,1,3)=="1/1") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="0/0") && (substr($15,1,3)=="0/0") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="1/1") && (substr($15,1,3)=="./.") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="./.") && (substr($15,1,3)=="1/1") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="0/0") && (substr($15,1,3)=="./.") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="./.") && (substr($15,1,3)=="0/0") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt

错误讯息:

slurmstepd:get_exit_code任务0死于信号

字段12-15的示例:

1/1:0,38:38:99:1149,114,0       1/1:0,39:39:99:1161,117,0       1/1:0,46:46:99:1383,138,0       0/1:21,18:39:99:413,0,524 

1 个答案:

答案 0 :(得分:0)

也许你可以改变这一切:

input=$1

output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="1/1") && (substr($15,1,3)=="1/1") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="0/0") && (substr($15,1,3)=="0/0") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="1/1") && (substr($15,1,3)=="./.") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="./.") && (substr($15,1,3)=="1/1") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="0/0") && (substr($15,1,3)=="./.") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt
output=$(grep -v '^#' ${input} | awk '(substr($12,1,3)=="./.") && (substr($15,1,3)=="0/0") {print $0}')
echo "$output\n" >> /proj/b2014091/nobackup/potHomoF1.txt

对此?

awk '!/^#/ && substr($12,1,3)~/[01.]\/[01.]/ && substr($15,1,3)~/[01.]\/[01.]/' <<< $1 > /proj/b2014091/nobackup/potHomoF1.txt

尝试以下两种方法:

awk '{a=substr($12,1,3);b=substr($15,1,3)} !/^#/ && ((a=="1/1" && b=="1/1") || (a=="0/0" && b=="0/0") || (a=="1/1" && b=="./.") || (a=="./." && b=="1/1") || (a=="0/0" && b=="./.") || (a=="./." && b=="0/0"))' $1 > /proj/b2014091/nobackup/potHomoF1.txt

input=$1
awk '{a=substr($12,1,3);b=substr($15,1,3)} !/^#/ && ((a=="1/1" && b=="1/1") || (a=="0/0" && b=="0/0") || (a=="1/1" && b=="./.") || (a=="./." && b=="1/1") || (a=="0/0" && b=="./.") || (a=="./." && b=="0/0"))' ${input} > /proj/b2014091/nobackup/potHomoF1.txt