|
I think, following will solve the problem, where I don't care about position of '+' and '-' signs in the values. I can just check values > 0 and the rest, and according to that sum them in 2 different variables as below:
awk ' {
value=substr($0,74,14)
if(value>0) { plus+=value}
else {minus+=value}
}
END { print plus, minus} ' filename | read credit debit
|