#! /usr/bin/gawk -f # usage: "$0 -vWORD=xxx < INFILE > OUTFILE" # Reads a list of words from stdin, one per line. # Outputs a list of all words that follow an occurrence of xxx. BEGIN { if (WORD == "") { printf "must define WORD\n" > "/dev/stderr"; exit 1 } take = 0 } /./ { if (take == 1) print $0 take = ($0 == WORD) next }