Related question: Finding all files containing a text string on Linux
I have been using the command mentioned in the answer of above question to search for string occurences in all files:
grep -rnw '/path/to/somewhere/' -e "pattern"
explainshell helpfully explains your command, and gives an excerpt from
-w, --word-regexp Select only those lines containing matches that form whole words.
So just remove
-w since that explicitly does what you don't want:
grep -rn '/path/to/somewhere/' -e "pattern"