Finding files containing 'string'

Daniel Vogel exed at hotmail.com
Wed Feb 1 23:00:25 UTC 2006



> > I had two suggestions:
> > 1. gnome-search-tool
> > 2. find ./ -name "*" -exec grep "string" {} /dev/null \;
> >
> > Someone suggested even a better command solution than 2. above but I
> > can't remember what it is.
> > --
>
>find . -type f -print0 |xargs -0 grep "string"
>
>should work.
>

..err...my sugestion is much simple...

grep -e <string> <files>

the for example:
grep -e Daniel *.html

will show me in wich file the line WITH the string "Daniel" will appear.
being more efficient, you can place another flag to show you the exact line 
number.

No need of cat, nor more to search on every file on a directory...haven't 
tryed yet on a full root search.

Hiope it helps.





More information about the users mailing list