grep a string on all files in the subdirectories

Hi all,

I would want to find a string 'abc' on all files which is located under a directory.

But inside the directory there are subdirectories, so how can I find whether 'abc' exists on all files in the subsequent subdirectories?

Thanks.

find /path/to/directory -exec grep "abc" {} /dev/null \;
1 Like

I would do it this way if you want to verify all files to reduce the output.

find /path/to/directory -exec grep -c "abc" {} /dev/null \;

Vino & reborg, thanks a lot for the statement.

grep -Rl string /path/to/dir

not available on all systems