find keyword

Hi,

This is my first post.

Please help me.
I wanted to find a particular key word in the entire system not in the filename, it should be in the file content.
The output should display me...

<The filename>, number of times the keyword is repeated.

like

file1: 2
file2: 4
file3: 6
file4: 8

Here, I wanted to do a case insensitive search and the keyword can be anywhere in the word like if i wanted to search 'cat', caterpilli,pillCAtaaa are to be dispalyed.

Regards,
Pointers.

use find and grep to do that. read man pages of

find 

and

grep

Hi,

To find the files with the string you desire,this will list all the files that has the below string. Now to match it exactly to your requirement , let me think ..if i get it i will post it.

find / -name "*.*" -exec fgrep -l "caterpilli" {} \;

This works for me , to find all files that has the string "/SFS"

find /export/opt -name "*.log" -exec fgrep -l "/SFS" {} \;

Thanks.

---------- Post updated at 01:16 PM ---------- Previous update was at 12:44 PM ----------

From man pages ,

grep -c will give count of the lines that matches t string, -i will ignore case. I don't have a shell now ,so i can't test it.

find / -name "*.*" -exec fgrep -lci "caterpilli" {} \;

Thanks

find . -name "*ca*" -print ; sudo find . -name "*CA*" -print