Click to See Complete Forum and Search --> : Using grep to find text


mairving
04-19-2001, 12:32 PM
I keep forgetting how to do this one. I am trying to search for text within files using grep. For instance, I want to find all files with the expression 'inp'. I want to search the current directory and the subdirectories also. Thanks

Pierre Lambion
04-19-2001, 02:51 PM
grep -r foo *

where -r is for recursive
foo is the string you search
* is the target (could be *.txt for instance)

You might want to add -i as an option to make the search case-unsensitive.

P.