TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:6388] Finding files quickly



A more bug-proof method would be:

locate tar |perl -ane '$F[0]=~/\/tar$/&&print'

Command-line perl is a handy tool indeed.  Not too many other utilities
can beat it WRT regular expressions.

-- 
Jim Raney

"I poured spot remover on my dog.  Now he's gone."	--Steven Wright
	
"At no time is freedom of speech more precious than when a man hits his
thumb with a hammer."    			-- Marshall Lumsden


On Mon, 7 Jun 1999, Sandipan Panigrahi wrote:

> Well here is a work around..
> 
> locate /tar | egrep tar$
> 
> The "/" makes sure the filename starts with tar in the path
> and the "$" in the egrep makes sure that there is nothing following tar.
> 
> Kludgy I guess !
> 
> You could alias this to something you like and I am sure there are
> bugs in it :-)
> 
> regards,
> sandipan
> 
> 
> Bob Tanner wrote:
> > 
> > Quoting Yaron (jethro@yaron.org):
> > >   Hi,
> > >
> > > On Mon, 7 Jun 1999, Bob Tanner wrote:
> > >
> > > > How do I use the updatedb stuff to find files quickly?
> > > >
> > > > I normally use find / -name "*filename*", is there a quicker way?
> > >
> > > Well, if updatedb is run occasionally from cron etc, you can go "locate
> > > filename".
> > >
> > > Red Hat automatically have this in /etc/cron.daily/
> > 
> > That is what I thought, but when I do a locate tar, I get a TON of files with
> > tar in the name:
> > 
> > /usr/X11R6/lib/X11/xfm/bitmaps/app_tar.xbm
> > /usr/X11R6/lib/X11/xfm/bitmaps/xfm_tar.xbm
> > /usr/X11R6/lib/X11/xfm/pixmaps/app_tar.xpm
> > /usr/X11R6/lib/X11/xfm/pixmaps/xfm_tar.xpm
> > 
> > Anyway to get just the file called tar?
> > --
> > Bob Tanner <tanner@real-time.com>       | Phone : (612)943-8700
> > http://www.real-time.com                | Fax   : (612)943-8500
> > Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tclug-list-unsubscribe@listserv.real-time.com
> > For additional commands, e-mail: tclug-list-help@listserv.real-time.com
> > Try our website: http://tclug.real-time.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@listserv.real-time.com
> For additional commands, e-mail: tclug-list-help@listserv.real-time.com
> Try our website: http://tclug.real-time.com
> 
>