Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Apr 2007 22:11:55 -0700
From:      Bill Campbell <freebsd@celestial.com>
To:        freebsd-questions@freebsd.org, Oliver Iberien <odilist@sonic.net>
Subject:   Re: Grep and --exclude? or, finding a text string that might be anywhere
Message-ID:  <20070422051155.GA13501@ayn.mi.celestial.com>
In-Reply-To: <996620.31871.qm@web58102.mail.re3.yahoo.com>
References:  <200704150923.25792.odilist@sonic.net> <996620.31871.qm@web58102.mail.re3.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 21, 2007, L Goodwin wrote:
>Oliver, the error is due to incorrect syntax ("-e" flag omitted). Try this:
>
>grep -R /usr -e "any2dvd"
>
>L Goodwin
>
>Oliver Iberien <odilist@sonic.net> wrote: I need to find a reference to an obscure delete port that is in some file 
>somewhere (in /usr/ports/? somewhere in /usr?) as it is messing up make and, 
>among other things, preventing me from running the gnome upgrade script. So, 
>I do what little I know to do:
>
>grep -R /usr/* "any2dvd"
>
>This brings out a few valid discoveries (mostly in mailfiles when I posted 
>about this) and lots of "operation not supported" and "No such file or 
>directory" errors before grep spits out a "memory exhausted" error. If I 
>could at least stop it from looking at */tmp/* and ~/.kde it might have a 
>chance to get somewhere, but I can't figure out how --exclude 
>or --exclude-dir work, despite googling over and over for examples. Can this 
>be made to work? Or is there a better way?

I generally use find, xargs, and grep for things like this:

find /usr -type f | xargs grep -l 'any2dvd'

	OR

find /usr -type f | egrep -v '/.kde|/tmp/' | xargs grep -l 'any2dvd'

Bill
--
INTERNET:   bill@Celestial.COM  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``If we got one-tenth of what was promised to us in these acceptance
speeches there wouldn't be any inducement to go to heaven.''
    Will Rogers



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070422051155.GA13501>