#Filter ASCII from Gonio to splot #This script moves ASCII in matrix-form to triplets #call: awk -f gonio2splot.awk infile delta_beta delta_alpha #It's only a quick and dirty hack:=) #new version translates output from Gonio and makes some precalculations #O.Schultz@enhydralutris.de, 21.06.2004 BEGIN{ {if (ARGC!=5) {print "Correct program call:\n awk -f gonio2splot.awk oink.prof beta alpha sensordistance[m] \n\n";exit}} {file=ARGV[1];filen=file;deltabeta=ARGV[2];deltaalpha=ARGV[3];me=ARGV[4];sw=0;i=2} {at=gsub(".prof",".splotn",filen)} {if (a>1) {print "Wrong Filename, only one .prof must occur";exit}} # {print "ARGC:"ARGC"\tfile:"file"\tbeta:"deltabeta"\talpha:"deltaalpha"\tme:"me} {print "#created by awk -f ascii2splot_new.awk " file " " deltabeta " " deltaalpha " "me >filen} } {if (substr($0,1,1) == "#") {print $0>>filen} else { {if (sw == 0) {{ncol=$1; sw=1} {for (i=2; i<=ncol+1; i++) {y[i]=$i}}} else {if (($1 "")=="") {exit} else { {{x=$1} {for (i=2; i<=ncol+1; i++) {print x/10-deltabeta"\t"y[i]/10-deltaalpha"\t"$i*me^2/100"">>filen} } {print " ">>filen} }}}}}} END{print "File "filen" written!"}