Sum all numbers in a file

Uses awk to sum all the numbers in a file. This command is also resilient to big numbers since it internally converts each number to a string.

Authored by: devnull
file_name

Command
Copy
awk 'BEGIN {OFMT = "%.0f"} { sum += $1 } END { print sum }' file_name
Tags