I have a scenario where i want to calculate the sum of below data set
V1|V2|V3
"1.1"|"1.2"|"A"
"1.1"|"1.2"|"B"
"1.1"|"1.2"|"C"
sum of V1 V2 ?
how to that
output :
3.3 3.6
I have a scenario where i want to calculate the sum of below data set
V1|V2|V3
"1.1"|"1.2"|"A"
"1.1"|"1.2"|"B"
"1.1"|"1.2"|"C"
sum of V1 V2 ?
how to that
output :
3.3 3.6
$ cat q
v1|v2|v3
"1.1"|"1.2"|"A"
"1.1"|"1.2"|"B"
"1.1"|"1.2"|"C"
$ sed 's|"||'g q | awk "-F|" \
'BEG{v1=0;v2=0;}NR>1{v1 = v1 + $1; v2 = v2 + $2;}END{print v1 " " v2}'
3.3 3.6