Note that the -w option is not in the standards and is not present on all systems. And since you have one word per line in your input file it is easy to match what you want even when the -w option is not available. The standards also say that egrep is obsolete and need not be available on conforming implementations. If you're writing new code, I'd suggest either:
grep -E '^(bob|sam|ed)$' file
or
grep -E '^bob$|^sam$|^ed$' file
even though I don't know of any implementation that doesn't still treat egrep as a synonym for grep -E .
As far as using single quotes or double quotes goes; either will produce the same results for these words. I use single quotes here because there is no need for the shell to perform the extra expansions that double quotes require; so single quotes are slightly faster.
Thanks for all your comments. The use of '^' and '$' work only if the keyword is the only word in the sentence. What if the keywords appear in the middle of a sentence? For example,
monday bob plays football
tuesday bobby plays hockey
wednesday sam plays volleyball
thursday sammy plays basketball
friday ed plays baseball
saturday eddie plays soccer
The following will give you lines containing bob, sam, or ed on a line by themselves, at the start of a line followed by a space, at the end of a line preceded by a space, or in the middle of a line with a space before and after the word: