Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Mar 2002 23:05:19 -0500
From:      mpd <mpd6334@cs.rit.edu>
To:        Peter Leftwich <Hostmaster@Video2Video.Com>
Cc:        questions@freebsd.org
Subject:   Re: grep.... recursive searching
Message-ID:  <20020308230519.A4253@rochester.rr.com>
In-Reply-To: <20020308215110.H68770-100000@earl-grey.cloud9.net>; from Hostmaster@Video2Video.Com on Fri, Mar 08, 2002 at 10:01:43PM -0500
References:  <20020307105721.A46199@rochester.rr.com> <20020308215110.H68770-100000@earl-grey.cloud9.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 08, 2002 at 10:01:43PM -0500, Peter Leftwich wrote:
> On Thu, 7 Mar 2002, mpd wrote:
> > On Thu, Mar 07, 2002 at 02:21:25PM +0000, Barry Byrne wrote:
> > > Mike: I think what you wish to to is use find to located certain files recursively and then grep these files for a specific pattern. If so, try something like:
> > > find /START/OF/PATH -name "FINDPATTERN" -exec grep "GREPPATTERN" {} \;
> > I know about this, but it's too much typing. I'm looking for functionality more like rgrep that comes with RH. Has anyone tried this on FreeBSD? This is the one thing I miss from using Linux.
> 
> Hi mike, and thanks list (I've been using grep something *, grep
> something */*, and so on, for years and now feel like Dorothy of Oz!)
> 
> You could write a very simple shell-script called rgrep.sh and then alias a
> command (depending on what shell you use in Unix) called rgrep.  (Or just
> chmod 755 rgrep.sh and put it in a directory that is in your PATH.)

That's exactly what I don't want to do. It's already been done,
so there's no need to re-invent the wheel. Code re-use == the bomb.

> 
> Shell scripts begin with a single line like this:
> #!/bin/sh
> 
> You can use if/else, case, and various test statements in shell scripts,
> and substitute (this may be tcsh-dependent) "$1" meaning "the thing typed
> on the command line after the command," in this example, rgrep
> expressionhere so $1 gets substituted for expressionhere.

Er, yeah. I've been scripting for years...

> 
> Shell scripting is useful -- I find -- to simplify very long commands that
> require you to escape certain punctuation and spaces by using the "force"
> *grins* OWKA "\" as in:
> 
> $ grep -i an\ example\ using\ spaces ~/myfile.txt

Why not just an alias rather than a full blown script?

> 
> > It's written in perl, but I can't find a copy anywhere right now. Will keep looking.
> 
> If it is written in perl, then just make sure perl is installed on your
> system (find out by typing which perl, or just the word perl), and if so
> you are in luck to use the old script, provided it doesn't have any "exec"
> calls that clash with whichever shell you use or are using.

I followed up to the list a few days ago, but I didn't have the thread
context in the reply.  The rgrep I was searching for is installed as
part of the jed port.

> 
> --
> Peter Leftwich

mike
-- 
___________________________________________________________
 
Little Girl: "MAY I GROW 3005 PLANTS??"
Pokey the Penguin: "NO"
	- from "3005 PLANTS"

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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