====== 20 awkで合計 ====== ===== 集計する ===== $ cat a 1 2 3 4 5 $ cat a | awk '{s+=$1} END {print s}' 15 ===== カラムが複数 ===== $ cat a 1 2 2 3 3 5 4 8 5 10 $ cat a| awk '{s1+=$1} {s2+=$2} END {print s1" "s2}' 15 28 {{tag>awk}}
$ cat a 1 2 3 4 5 $ cat a | awk '{s+=$1} END {print s}' 15
$ cat a 1 2 2 3 3 5 4 8 5 10 $ cat a| awk '{s1+=$1} {s2+=$2} END {print s1" "s2}' 15 28