Sum a numeric CSV column while skipping the header
Build a paste-ready command, then review its compatibility and effects before running it.
awk -F, -v column=<column> 'NR>1 {sum += $column} END {printf "%.2f\n", sum}' <file>Complete required fields to copy the generated command.
read-onlyno known side effects Compatibility
Linux + macOSVerified for Linux, macOS using bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementsawkawk must be installed and available on PATH.
Version supportawk Current supported releasesVerified for linux, macos using bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signals18432.75Representative successful output; values vary with the selected target and system state.
Known errorsawk: command not foundawk is missing or is not available on PATH.
Verifyawk -F, -v column={{column}} 'NR>1 {sum += $column} END {printf "%.2f\n", sum}' {{file}}The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01awkCommandRuns the awk stage of this one-liner.
02-F,OptionConfigures awk with the -F, option.
03-vOptionAssigns the following name and value before the awk program runs.
04column=<column>ParameterA value supplied in the Fill parameters section.
05'NR>1 {sum += $column} END {printf "%.2f\n", sum}'ArgumentPasses 'NR>1 {sum += $column} END {printf "%.2f\n", sum}' to awk.
06<file>ParameterA value supplied in the Fill parameters section.
This advanced community-curated one-liner combines several stages. Review every option and placeholder before running it.
Example input
awk -F, -v column=3 'NR>1 {sum += $column} END {printf "%.2f\n", sum}' invoices.csv
Illustrative output — exact values vary by system and data.
Official sources