The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 02-09-2007
berlin_germany berlin_germany is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 17
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