/remove 1/ {printf "set output '%s'\n", gpsname} 
/remove 2/ {printf "p \"%s\" u 1:3 t \"Minimum Energy\" w l lw 3, \"%s\" u 1:2 t \"Average Energy\" w l lw 2 lt 3\n", gvname,gvname} 
{if (($1) != "remove") print $0}