How to find a specific files in a many directory

Dear All,

Appreciate some help here.

I have a log of report. It located in several directory as below:

Directory:
mysscpr1
mysscpr2
mysscpr3
my_scnpr4

In the directory it contain hundred of files.

i need to find a specific files that contain 'invc2345' in the directory.

How can i do that? without need to 'cd <directory name> ' and then use the grep command one by one in every directory such as

cd <directoryname>

grep invc2345 *

Please assist

Use the find and grep command together.That should solve the purpose..

find . -name mysscp l -exec grep invc {} \;

Dear nua,

May be my explaination is not clear:

This is the sample of directory:

drwxrwxr-x 3 xxxxx ulol 368640 May 28 14:24 mycrdpr1
drwxrwxr-x 3 xxxxx ulol 96 Oct 19 2007 mycrdpr2
drwxrwxr-x 3 xxxxx ulol 96 Oct 1 2007 mycrdpr3
drwxrwxr-x 3 xxxxx ulol 96 May 23 08:15 myfinpr2
drwxrwxr-x 3 xxxxx ulol 8192 Mar 1 08:26 myfinprn
drwxrwx--- 2 xxxxx ulol 96 Jul 26 2007 mynpprn1
drwxrwxr-x 3 xxxxx ulol 16384 May 26 12:56 mypngpr1
drwxrwxr-x 3 xxxxx ulol 1064960 May 28 14:26 mysscpr2
drwxrwx--- 2 xxxxx ulol 96 May 15 06:00 sgisbprn1

I'm looking for an invoice number JHK8888 where it located in one of the directory and in a file under the directory.

Below is the sample of file under the directory:

-rw-r----- 1 1253 ulol 5386 Jul 6 2007 IBCRNtKL.abor.212113
-rw-r----- 1 1253 ulol 200070 Jul 9 2007 IBCRNtKL.abor.212941
-rw-r----- 1 chaiyeel ulol 5270 Jul 30 2007 IBCRNtKL.chel.2220
50

The problem is i also dunt know where is the file located and under which directory. I dont want to cd directory one by one and user grep to look for the invoice number. I want to make it easy.

Please advice.

Rgrds

Shahril

grep -R "<Search String>" *

Dear siba,

Please find error below:

$ grep -R JHBI11117 *
grep: illegal option -- R
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] -e pattern_list...
[-f pattern_file...] [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] [-e pattern_list...]
-f pattern_file... [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] pattern [file...]
$

Have u checked the man page for grep command?
If -R is not working then u can use -r here and try it.


find /path/to/find -type f -name "pattern_of_file" -o -name "pattern_of_file" | xargs grep -i "pattern_to_find"

Thanks

Using find command

ex. find . -name fileName