shell 求一列的和 awk 里面开始变量都是0 cat s.txt | awk '{total=total + $1}END{print total}'; printf "%.2f",var 转载于:https://blog.51cto.com/qinxm520/1095796