awk '{count+=1; if(substr($0,1,1)=="#") count=0; dx=$1-xold; if(count==1) print $1, 0.0; if (count>1) {sum+=dx*($2+yold)/2; print $1, sum}; xold=$1; yold=$2}' 
