I want to sum over floats of the form: 3.016e-06 The floats are saved in a files called S_3x3.txt S_4x4.txt ... S_8x8.txt My code sums only the first integer. Instead of 3.016e-06 + 4.022e-06 it calculates 3 + 4. How can I fix this?
x=3 while [ $x -le 8 ] do find . -name "S_$((x))x$((x))*" -print | sort -t'_' -nk3 | xargs -J {} awk -F' ' 'FNR == 1 && !/^($|#)/{ sum+=$1) }END{ print sum }' {} >> cS_CPU.txt x=$(( x+1 )) done
"S_$((x))x$((x))*"-- that's a funny place to use arithmetic evaluation. Why not"S_${x}x${x}*"cat -vetto see.