I have a file which has following contents which I want to add up.
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
28170.24
139038.72
139038.72
139038.72
139038.72
139038.72
139038.72
139038.72
139038.72
139038.72
Now when I use
paste -s -d+ <file-name>
it gives the string that I am looking for.
+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+21125.12+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+21125.12+14080.00+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24+28170.24
But when I give
paste -s -d+ <file-name> | bc
I do not get any output. :wall:
Even for loop fails with error..
bash: ((: 139038.72: syntax error in expression (error token is ".72")
bash: ((: 139038.72: syntax error in expression (error token is ".72")
bash: ((: 139038.72: syntax error in expression (error token is ".72")
bash: ((: 139038.72: syntax error in expression (error token is ".72")