Linux – Using grep to find a string in files

greplinux

How can I find a string in files in a directory, using file names beginning with the letter a.
I also want to get the number of occurrences of this string from the grep I run.

I tried this

cat * | grep -c string but it searches all files. I just want to search files that begin with letter a

Best Answer

grep -c string a*
Related Question