Bash Decimal Addition using bc

Hi guys/gals i have a quick question. I am trying to read from a file and add the values up but the problem is the values are not integers their floats so i tried to used bc but failed epicly lol. Any tips would be great. Thanks

this is the code i have so far :

while read num
do
    total=$(echo "scale=2; $num + $total" | bc)
done < <(cat file.txt)

echo "Total: " $total

Hi.

Can you post a sample of the input file?

$ cat file1
1.1
3.2
5.9

$ total=$(paste -sd+ - < file1 | bc)

$ echo $total
10.2

Here's one of the file i have to work with.

A glance at "file.txt" suggests that it needs some preprocessing.

There is a textual heading on line 1.
There are numerous blank lines.

No problem with the numbers. They are consistently to two decimal places.

Because I had no problem reading the file with M$ "notepad" you will be converting the file to unix text file format?

i figured the heading wouldn't affect the read in unless im mistaken but i could easily remove that. And the spaces could be taken out using sed '/^$/d' file.txt
so im still having trouble with reading from the file and using bc. I keep getting parse error.

bc may be more trouble than it's worth here.

$ awk '{T+=$0} END { printf "%.2f\n", T }' file1
63304750.57

awesome that works. Thanks