There are 2 ways to find whole words with help
- -w option
\b word boundaries in match pattern
Use -w option to specify that it's whole word:
grep -w "str"
\b to match on "word boundaries", which will make your search match on whole words only:
Adding additional options might help too by adding color, line numbers, recursive search and other features:
grep -binrw "str"
grep -binr "\bSTR\b"