I'm processing some data using bash
. I'm checking whether the data is complete by summing up the first column. It should consist of 0 - 500 with 0.1 increment. Unfortunately, the actual numbers are slightly off so that the sum can equal 1250653.9 instead of 1250250.0 . This could be avoided if I rounded each number before summing. Currently, I use the following:
cat L_z_expectation.dat | awk '{ print $1 }' | paste -sd+ | bc
Is there a way of pasting "+0.0001" to each row, then individually piping each row to bc in a single line?