C:\stuff> perl -ne "print if /\b(foo)\b/" < input.txt > matching.txt