3 ms·
'wc -l' counts the number of lines. It also supports '-c' and '-b'. To work with input split into columns, use awk. By default, it assumes the columns are sepa
by alco 12y ago
'wc -l' counts the number of lines. It also supports '-c' and '-b'.
To work with input split into columns, use awk. By default, it assumes the columns are separated with spaces. This can be customized with the '-F' option.
So your last example can be rewritten as
awk -F, '{s+=$1} END{print s}' data.csv