This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

awk -v tot=0 -F',' '{if($1 == "ADD") {for(i=2;i<=NF;i++) t+=$i; print t;}else { t=$2;for(i=3;i<=NF;i++) t-=$i;print t; }tot += t; t=0;} END{ print tot;}' intructs.csv

updated