Use find
find /home/*/public_html -type f -exec grep -l 'pattern' {} +
The + modifier allows you to group file names in managed chunks.
However, you can do this with grep -r . The arguments for this should be directory names, not file names.
grep -rl 'pattern' /home/*/public_html
This will only contain 500 arguments, not thousands of file names.
source share