Re: Searching contents of files

2003-10-23 Thread Richard Coleman
Here is the classical way to do a recursive grep.

For csh/tcsh, define the alias

   alias rgrep 'find . -type f -print | xargs egrep -i \!* /dev/null'

For bash/zsh, define the shell function

   rgrep() { find . -type f -print | xargs egrep -i $1 /dev/null}

There are several variations of these that will work.  But these are 
both fast and portable, and should work on virtually any flavor of unix.

Richard Coleman
[EMAIL PROTECTED]
jason dictos wrote:

Hi All,

   I've always used grep text /*/*/* to recursivly search directories for 
files with the specified text string in them, however this method doesn't 
always work very well (sometimes it bails out halfway through with error 
Argument list too long). 

Is there a more effective way to search the contents of files?


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Searching contents of files

2003-10-22 Thread jason dictos
Hi All,

   I've always used grep text /*/*/* to recursivly search directories for 
files with the specified text string in them, however this method doesn't 
always work very well (sometimes it bails out halfway through with error 
Argument list too long). 

Is there a more effective way to search the contents of files?

Thanks,
-Jason
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Searching contents of files

2003-10-22 Thread Kevin D. Kinsey, DaleCo, S.P.
jason dictos wrote:

Hi All,

  I've always used grep text /*/*/* to recursivly search directories for 
files with the specified text string in them, however this method doesn't 
always work very well (sometimes it bails out halfway through with error 
Argument list too long). 

Is there a more effective way to search the contents of files?

Thanks,
-Jason
 

$grep -r text *

Kevin Kinsey
DaleCo, S.P.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Searching contents of files

2003-10-22 Thread Viktor Lazlo


On Tue, 21 Oct 2003, jason dictos wrote:

I've always used grep text /*/*/* to recursivly search directories for
 files with the specified text string in them, however this method doesn't
 always work very well (sometimes it bails out halfway through with error
 Argument list too long).

 Is there a more effective way to search the contents of files?

Try:

 find /whateverdirectory -type f -print | xargs grep mysearchstring

Cheers,

Viktor
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]