# -+- number -+- category -+- title -+- email -+- name -+- homepage -+- clickOnName -+- language -+- image -+- browser-used -+- security-cookie =0 -+- 2004-10-26:1 -+- UNIX Basics -+- Finding given String in files in a directory -+- bvss@iitg.ernet.in -+- saikrishna -+- -+- nolink -+- English -+- -+- Mozilla/5.0 (compatible; Konqueror/3.2; Linux) (KHTML, like Gecko) -+- 9614

If you are looking for a simple solution to search through the files in a given directory for a string .


This is done using find & grep.
find [directory : ex: / . /home/user] "*.fileex" -exec grep "string or pattern" {} \;

Example :
find . -name "*" -exec grep "PageFaultException" {} \;

The above command will search All files in the given directory for the string PageFaultException in it.

but this wont print the file name in which the pattern/string is found.
Now just add /dev/null before the \; & now filenames are displayed.

Example :
find . -name "*" -exec grep "PageFaultException" {} /dev/null \;

HTH
sai