Recursive grep

Contributor Icon Contributed by roshi Date Icon October 7, 2004  
Tag Icon Tagged: UNIX

This tip is for grepping a pattern even in the sub-directories of a particular directory in addition to the files in the current directory.

Since grep -R <> <> is not available on all flavors, this can be really helpful.


The command is as follows :-

find -name | xargs grep

The arguments are self-explanatory.
The output of find will be xarg‘ed to the input of grep
and these will be searched for searchstring.

Previous recipe | Next recipe |
 

Viewing 7 Comments

 
close Reblog this comment
blog comments powered by Disqus