summing up the fields in fixed width file

Hi,

I have a fixed width file with some records as given below:

" 1000Nalsdjflj243324jljlj"
"-0300Njfowjljl309933fsf"
" 0010Njsfsjklj342344fsl"

I want to sum-up first field values(i.e from 2nd character to 6th character)of each record.

so for the above file i want to add (1000 - 300+ 10)

For this Im using the below awk code:
amount=`awk '{a=substr($0,2,4)} {sum+=a} {print sum}' filename`

But the value im getting in "amount" variable is "1000 700 710".

I want to get only the final total(i.e only 710) in "amount" variable.

Please help me in this and let me know any other better options to achive this.

Thanks,
Sri

Add everything up and "END" print the final result:

awk '{sum+=substr($0,2,5)}END{print sum}' filename

Thanks danmero ... its working fine now.. !