[linux]$ cat test.txt
123.52
125.54
126.36
[linux]$ awk '{sum += $1};END {print sum}' test.txt
375.42
对文件test中 第一列为aaa的行求和
[linux]$ cat test.txt
aaa 123.52
bbb 125.54
aaa 123.52
aaa 123.52
ccc 126.36
[linux]$ awk '/aaa/ {sum += $2};END {print sum}' test.txt
370.56