BEGIN{ previous=0 line=0 printf "step \t x \t y \t z \n" } { line++ if (line > 2 && $1!=0 && $1%100==0) { if ($1 !~ /#/){ if ( $1 < previous){ new = previous + 100} else{ new = $1} previous = new printf "%d \t %8.4f \t %8.4f \t %8.4f \t %8.4f\n",\ new, $2, $6, $10, $2*$6/128 } } } END{print "END" }