Finding files containing 'string'

Anne Wilson cannewilson at tiscali.co.uk
Thu Feb 2 16:38:41 UTC 2006


On Wednesday 01 Feb 2006 23:00, Daniel Vogel wrote:
> > > 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.

The problem is that, while this looks simple, I'm trying to find all 
config files that refer to my lan-name, and config files don't have a 
specific extension.  In fact I can't think of any regular pattern to 
their names.

The problem with searches like Aaron's and Les' is that they pick up all 
the hundreds of email messages from both my current installation and 
the previous one, since I routinely mount an OldHome partition (one 
such search is still running).  I could umount OldHome, but there's 
still going to be a lot of mail messages.  Then there are hundreds more 
in the kde tmp files.  Maybe I'm asking the impossible.  I'll just have 
to back up and hope I find all the ones I need without too much delay.  

Thanks to all for the suggestions.

Anne
-- 
Registered Linux User No.293302 (http://counter.li.org/)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20060202/6835171f/attachment-0001.sig>


More information about the fedora-list mailing list