#!/usr/bin/awk -f #usage .make-topfile archive.dat # run this on the archive subsets one by one to produce a top # file that displays the cross sections 12 to a page # with linear and log scales BEGIN{ printf "%s \n", "set font duplex"; printf "%s \n", "set dev post color sideways"; dq = "\""; tt = "Title Top"; cs = "DS/DWDE (NB/SR/GEV)"; printf "%s \n", "new plot"; twelve=12; } # test to see if this is matches the Z and A by looking at the first two columns # $1==Z&&$2==A{ # make a test; if the energy or angle changes (cols 3 and 4) then store them; # first time through, since laste and lastt are undefined it is true { plotit=0; if ($3!=laste || $4!=lastt || $1!=lastz || $2!=lasta) { lastz = $1; lasta = $2; laste = $3; lastt = $4; plotit=1; jj=1; # count the lines since the change if (i>11){ i=0; printf "%s \n", "new plot"; } plotn = twelve -i; if (plotn!=12) print "plot"; printf "%s %2d %s \n", "set window ",plotn, " of 12"; printf "%s \n", "set symbol 2O"; print "set bar size 0.0"; print "set order x y dy"; printf " %s %1s %d %d %8.3f %4.1f %1s %s %s \n",tt,dq,$1,$2,$3,$4,$8,dq,"size=1.0"; printf "%s %s %s %s \n","Title Bottom",dq,"N(GEV)",dq; printf "%s %s %s %s \n", "CASE ",dq,"G",dq; printf "%s %s %s \n", "TITLE LEFT ",dq,cs,dq; printf "%s %s %s %s \n", "CASE",dq,"LG LFL LL LL L ",dq; printf " %8.3f %10e %10e \n", $5,$6,$7; # print data ++i; #increment i } else ++jj; increment jj printf " %8.3f %10e %10e \n", $5,$6,$7; # print data if (plotit == 1 && jj > 2) printf "%s \n","plot" } END{ printf "%s \n","plot" }