[awk] if else if 用法

stn=12345
awk '{
if ($1 == '${stn}' && $14 >= 34) {print $2 "," $14 ",A," $45 "," $36 "," $1 ","}
else if ($1 == '${stn}' && $14 < 32) {print $2 "," $14 ",B," $45 "," $36 "," $1 ","}
else if ($1 == '${stn}' && $14 < 34 && $14 >=32) {print $2 "," $14 ",C," $45 "," $36 "," $1 ","}
}' input.txt > output.txt

留言