awk -F, 'NR>1 {s+=$4; n++} END {print s/n}' data.csv

Category: Data Science & Analysis

awk -F, 'NR>1 {s+=$4; n++} END {print s/n}' data.csv

Average column 4 of a CSV, skipping the header

The -F, flag sets the field separator to a comma. NR>1 skips the header row, then each line adds field 4 to s and counts it in n; the END block prints the mean. This is the minimal awk averaging pattern for CSV files. For multiple statistics, datamash is easier and less error-prone; field numbers start at 1, with $1 the first column.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.