Например так: awk 'BEGIN {FS = "|"} {sum+=$1} END {print sum}' filename.txt или так: awk 'BEGIN {FS = "|"} ; $1 ~ /^smith$/ {sum+=$3} END {print sum}' или даже так: awk '{a[$1] += $3} END {for (i in a) print i, a[i]}' filename.txt
Awk/Sed Справочник v0.05 © 2007-2024 Igor Salnikov aka SunDoctor