datamash -H -t, --header-in sum 4 < data.csv

Category: Data Science & Analysis

datamash -H -t, --header-in sum 4 < data.csv

Sum column 4 and print the column name as a header

The -H flag prints a header line in the output, naming the statistic and the field it came from. Combined with --header-in (input has a header) this round-trips the column name into the result, keeping downstream tools and reports readable. Without -H the output is just the bare number. This flag pair is the common pattern for datamash one-liners.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.