i have to search for a particular text in files and for that im using grep command but it searches only in current folder.What i want is that using a single grep command i can search a particular thing in the current folder as well as in all of its sub folders.How can i do that???
views:
52answers:
2
+1
A:
man grep
says
-R, -r, --recursive
Read all files under each directory, recursively; this is
equivalent to the -d recurse option.
aioobe
2010-06-21 10:33:20
i was trying this only but its not searching in sub directories
developer
2010-06-21 10:40:00
which system are you on?
aioobe
2010-06-21 12:00:00
+1
A:
POSIX grep does not support recursive searching - the GNU version of grep does.
find . -type f -exec grep 'pattern' {} \;
would be runnable on any POSIX compliant UNIX.
jim mcnamara
2010-06-21 10:39:55