Suppose I have a data frame like:
A,B,C,D
2,1,1,1
2,3,1,4
I want to get the total sum of the data frame, meaning that just a total value as an output.
So for the given example, the output should be 15
I tried this but it gives sum for each column:
awk -F"," 'BEGIN {sum=0; OFS=","} {for (i=1; i<=NF; i++) a[i]+=$i } END {for (i in a) print a[i]}' file