Hi everybody:
I have files where some values are -9999, and I would like to average some columns each five values but when the value is -9999 will skipped.
I tried this:
awk '{if ($5==-9999) skip; {s+=$5;++c}};{avg=s/5};{if(c==5){print $1, $2, $3, avg ; c=0; s=0}}' $fitxer.tmp2 > $fitxer.cl31;
but do not work correctly.
Somebody couls help me.
Thanks in advance
I have files where some values are -9999, and I would like to average some columns each five values but when the value is -9999 will skipped.
I tried this:
awk '{if ($5==-9999) skip; {s+=$5;++c}};{avg=s/5};{if(c==5){print $1, $2, $3, avg ; c=0; s=0}}' $fitxer.tmp2 > $fitxer.cl31;
but do not work correctly.
Somebody couls help me.
Thanks in advance