how to grep some text in a directory and as well as in its sub-directories

Hi Friends

Little help is required. I want to grep some string in a directory as well as in its sub-directoies.

Thanks
Joy:confused:

not 100% sure what you mean... can you give an example?

A -is directory B, C,D are the subdirectories. Under B G,H are the subdirectories. Each directory contains some files. I want to grep one string which can be there in any files. I don't want to go to each directory and then grep. I want to grep it from A directory itself.

Thanks
Joy

try find ... (on HP-UX)

find /start_dir -type f -xdev -print -exec grep string {} \;

Will display the filename that contains searched and each occurance of the string if found.

Hope that helps ...

Hi,
You can do this.

grep <your string> /path/to/the/dir/*

This lists all the matching cases of your string in that particular directory of your choice