From owner-freebsd-questions@FreeBSD.ORG Thu Oct 23 02:52:01 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47A1216A4B3 for ; Thu, 23 Oct 2003 02:52:01 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8697643F75 for ; Thu, 23 Oct 2003 02:52:00 -0700 (PDT) (envelope-from richardcoleman@mindspring.com) Received: from adsl-068-213-016-023.sip.asm.bellsouth.net ([68.213.16.23] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (Exim 3.33 #1) id 1ACc8N-0006ef-00; Thu, 23 Oct 2003 02:51:59 -0700 Message-ID: <3F97A4C2.1080001@mindspring.com> Date: Thu, 23 Oct 2003 05:52:02 -0400 From: Richard Coleman Organization: Critical Magic, Inc. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4.1) Gecko/20031008 X-Accept-Language: en-us, en MIME-Version: 1.0 To: jason@dictos.com References: <200310211158.11136.jason@dictos.com> In-Reply-To: <200310211158.11136.jason@dictos.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-ELNK-Trace: 1ee258965991efcb0865379cdb43356e5e89bb4777695beb702e37df12b9c9ef198dfb0f2b6ce25f48f7e00268bc497e350badd9bab72f9c350badd9bab72f9c cc: questions@freebsd.org Subject: Re: Searching contents of files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: richardcoleman@mindspring.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2003 09:52:01 -0000 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 richardcoleman@mindspring.com 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?