Find files containing text using grep command starts with file name charector Find files containing text using grep command starts with file name charector unix unix

Find files containing text using grep command starts with file name charector


You can use this,

find . -name 'E*' -exec grep -Hl "sample" {} \;

Explanation:

-H : Print the file name for each match.

-l : Suppress normal output


You can combine find and grep:

find . -name "E*" | xargs grep -nH "my text"

You can also use finds exec parameter instead of xargs. Take a look at its man mange for this: man find


If you want a max-depth for 1 layer, then i think most efficient way would be...

grep <pattern> E*

for multiple levels you can use like this

grep <pattern> */*/E*