in reply to word finder
perl -ne 'print if /\bfoo\b/' in.txt [download]
If that's not it, start with a better problem statement.