[huskerlug] Re: Text search
- From: "Cesar Delgado" <cdelgad2@xxxxxxxxxxxxxx>
- To: <huskerlug@xxxxxxxxxxxxx>
- Date: Mon, 28 Oct 2002 23:36:55 -0600
Of course it does! The last argument tells grep, or egrep, where you
want it to look for things. You probably want
egrep textToFind -i -r /
not
egrep textToFind -i -r ~/notes
which searches in the users home directory and /notes. The ~ is equal
to /home/UserName in RedHat and a lot of Linux Distros. In any other
UNIX they point to wherever it keeps the home dir. Cool trick, eh?
-Cesar Delgado
---------------------------------------------
Secure Distributed Information @ UNL
http://rcf.unl.edu
cdelgad2@xxxxxxxxxxxxxx, beettlle@xxxxxxxxxxx
> -----Original Message-----
> From: huskerlug-bounce@xxxxxxxxxxxxx [mailto:huskerlug-
> bounce@xxxxxxxxxxxxx] On Behalf Of Jim Macdonald
> Sent: Monday, October 28, 2002 11:25 PM
> To: huskerlug@xxxxxxxxxxxxx
> Subject: [huskerlug] Re: Text search
>
>
> I tried this one and:
>
> If I am logged in as Name, it searches /home/name/notes
> even if I am at /
>
> If I am logged in as Root, it searches /root/notes
> even if I am at /
>
> So I can't search /etc/ with this syntax.
>
> Shane Geiger wrote:
>
> > > Before the real guru's show up, I'll chime in:
> >
> > Okay, I'm here now. Thanks for the intro, Carl. ;-)
> >
> > You can probably use grep...but why? I got hooked on extended grep
> (egrep) and didn't look back.
> >
> > egrep textToFind -i -r ~/notes
> > -- does a recursive, case-insensitive search for "textToFind" in
the
> directory specified, ~/notes
> >
> > What's cooler is that egrep supports regular expressions in a way
grep
> can only dream about.
> >
> >
> > > grep
> > >
> > > man-o-man it's amazing what you can do with grep and pipes.
> > >
> > > I'm not certain how to do it for an entire filesystem without
creating
> a
> > > simple shell script, but you can search all the files in the pwd
by
> > > doing
> > >
> > > grep -i text_I_want_to_find *
> > > (this will return something in the format
> > > filename: line of text with text_I_want_to_find
> > >
> > > Doing a foreach directory loop in a shell script will search
> everything.
> > >
> > > If you'd like more detail, reask, I'd be happy to whip a quick and
> dirty
> > > script (either shell or perl) to do this.
> > >
> > >
> > > OH OH OH
> > >
> > > Try this
> > > cd /
> > > grep -iRo text_to_find *
> > >
> > > Cheers,
> > > Carl Lundstedt
> > > UNL
> > >
> > >
> > > On Mon, 2002-10-28 at 10:27, Jim Macdonald wrote:
> > > >
> > > > I need to find a program that will search the files on a non-
> graphical
> > > > RedHat 7.2 box for a text string and return a list of files
> containing the
> > > > said string.
> > > > It needs to be able to search the WHOLE hard drive (in this
case)
> > > > preferably the entire file system.
> > > > Or any given portion thereof.
> > > >
> > > > Anybody know of such a thing??
> > > >
> > > > Jim Mac
> > > >
> > > >
> > > > ----
> > > > Husker Linux Users Group mailing list
> > > > To unsubscribe, send a message to
huskerlug-request@xxxxxxxxxxxxx
> > > > with a subject of UNSUBSCRIBE
> > > >
> > > >
> > >
> > >
> > >
> > > ----
> > > Husker Linux Users Group mailing list
> > > To unsubscribe, send a message to huskerlug-request@xxxxxxxxxxxxx
> > > with a subject of UNSUBSCRIBE
> >
> > ----
> > Husker Linux Users Group mailing list
> > To unsubscribe, send a message to huskerlug-request@xxxxxxxxxxxxx
> > with a subject of UNSUBSCRIBE
>
>
> ----
> Husker Linux Users Group mailing list
> To unsubscribe, send a message to huskerlug-request@xxxxxxxxxxxxx
> with a subject of UNSUBSCRIBE
----
Husker Linux Users Group mailing list
To unsubscribe, send a message to huskerlug-request@xxxxxxxxxxxxx
with a subject of UNSUBSCRIBE
- References:
- [huskerlug] Re: Text search
- From: Jim Macdonald
Other related posts:
- » [huskerlug] Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- » [huskerlug] Re: Text search
- [huskerlug] Re: Text search
- From: Jim Macdonald