# print subset of file with timestamp NOT between # specified startSec and endSec. # timeStamp is in first column # Presumes that file timestamps are sorted in increasing order. BEGIN { if (ARGC < 3) { print "usage: startSec endSec timestamp-file"; exit; } startSec = ARGV[1]; ARGV[1] = ""; endSec = ARGV[2]; ARGV[2] = ""; if (endSec <= startSec) { printf "endSec must be greater than startSec\n"; exit; } } NF == 0 { next; } /^#/ { print; next; } { if ($1 < startSec || $1 > endSec) { print; } else { nExcluded++; printf "# EXCLUDE %s\n", $0; } } END { printf "Excluded %d records from time window %d : %d (%d sec wide)\n", nExcluded, startSec, endSec, endSec-startSec; }