awk '{if($3 != 0) a = ($3/$4) print $0,a; else if($3==0) print $0,"-" }' file > out
为什么?
awk '{if($3 != 0) {a = ($3/$4); print $0,a;} else if($3==0) print $0,"-" }' file > out