BEGIN { if (ARGC < 3) { print "ARGC: " ARGC; print "usage: time-window-file data-file"; exit; } printf "ARGV[1]: %s ARGV[2]: %s\n", ARGV[1], ARGV[2]; cmd = "cp " ARGV[2] " tmp.input"; ARGV[2] = ""; system(cmd); } /^#/ { print; next; } { cmd = "awk -f excludeTimeWindow.awk " $1 " " $2 " tmp.input > tmp.output; mv tmp.output tmp.input"; print "cmd: " cmd; print cmd | "/bin/sh" close("/bin/sh"); } END { system("cat tmp.input"); }