awk if print awk -F"," '{ if($4=="abc" && $5=="def"){print $1} else {print $0} } ' test.txt 输出 为江苏的号段 $0为整行 $1是第一个字符串