I got a .txt file with 2 columns of values. They are 2D coordinates, so the first column represent the x value and the second one is the z value. Unfortunately there are som
This is one way with awk
:
$ awk '{a[$1]+=$2; ++b[$1]} END {for (i in a) print i, a[i]/b[i]}' file
435.212 108.899
435.25 108.9
435.238 108.9
435.262 108.9
435.275 108.9
{a[$1]+=$2; ++b[$1]}
a
.b
.END {for (i in a) print i, a[i]/b[i]}'
To have another number format (4 float values for example) you can also use:
printf "%d %.4f\n", i, a[i]/b[i]