Problem with AWK in formating the data [message #140975] |
Thu, 06 October 2005 08:03 |
rajus19
Messages: 18 Registered: September 2005
|
Junior Member |
|
|
Hi All,
I am using "awk" command to find the sum of the sal for all the emps. The emp data is available in a flat file (in_file). The sal field is from the 21st to 32nd character (right justified with Zeros).
I am using the below command to find the tatal sal, but its not giving the output in proper format.
total=`awk '{(tot_sal=tot_sal+ substr($0,21,12))} END {print tot_sal}' ${in_file}`
Your help will be greatly appreciated.
Thanks
Raju
|
|
|
|
|
|
|
|