[Scottish] Best way to find text within files recursively?

Paul Millar scottish at mailman.lug.org.uk
Mon Jan 20 00:03:01 2003


On Sun, 19 Jan 2003, Michael Cameron wrote:
> > find . -type f -exec grep 'foo' {} /dev/null \;
> 
> > Also, since grep is only spawned with one filename, it will not
> >(iirc) issue the names of matching files in addition to the matching
> >line itself.  
> 
> /dev/null is the second file

Alternatively, one could use grep's -H option ;^)

Paul.


-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
Particle Physics (Theory & Experimental) Groups                Dr Paul Millar 
Department of Physics and Astronomy                     paulm@astro.gla.ac.uk
University of Glasgow                                 paulm@physics.gla.ac.uk
Glasgow, G12 8QQ, Scotland             http://www.astro.gla.ac.uk/users/paulm 
+44 (0)141 330 4717        A54C A9FC 6A77 1664 2E4E  90E3 FFD2 704B BF0F 03E9
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --