Calculate average parental genotype
Beside the correct question by @Kamil, this sounds like a job for datamash.

First let's get the number of columns in the file

$ head -n1 genotypes.txt| awk -v FS="\t" '{print NF}'


Now lets calculate the average per column with datamash

$ datamash -H mean 2-&lt;n&gt; &lt; genotypes.txt &gt; mean.txt


Replace &lt;n&gt; with the number of columns we received with command above.

For your example the output will look like this:

mean(SNP1)  mean(SNP2)  mean(SNP3)  mean(SNP4)
0,5 0   1,5 1,5


One can remove the mean with sed

$ sed -i -e 's/mean(//g' -e 's/)//g' mean.txt