Sum the numbers in a column with awk
awk sum column | add up numbers in a column linux | sum values in a file command line | awk | sum | columnsawk -v c=10 '{s += $c} END {print s}' /var/www/vhosts/system/example.com/logs/access_ssl_logSums the values of the given column across all lines, with columns separated by spaces or tabs. In the example, column 10 of an access log in combined format yields the bytes served. Non-numeric values such as - count as 0.
Note: A pipe works instead of a file too, for example du -s * | awk .... For other delimiters, add -F';'.
Also searched as
- awk sum column
- add up numbers in a column linux
- sum values in a file command line