Awk Example awk -F ',' 'BEGIN{sum=0}{sum+=$2}END{print sum}' awk '{if($6 > 20 && $6 <=50) {safe++;print "OK"}}' filename 引用 https://www.chedong.com/blog/archives/000682.html.