I know you can alter the amount of floating points in a textfile of values with something along the lines of:
awk '{printf("%.2g",$1)}' filename.txt
which will reduce everything to two decimal digits. However, if I have a string in bash:
echo ${array1}
-82.534592 -82.511200 -82.478912 -82.490959 -82.521393 -82.529610 -82.503510 -82.478218
How do I convert all values in the array to have x number of significant digits / floating point values? For example, if I wanted everything to have 2 significant digits, the output would be:
echo ${new_array1}
-82.53 -82.51 -82.48 -82.49 -82.52 -82.53 -82.50 -82.48