VAR=word awk ' /'"$VAR"'/ { lastmatch = linecnt } { line[linecnt++] = $0 } END { for (i = 0; i < lastmatch; i++) print line[i] } '