Linux-Hams archive - January 1998: Re: GREP

Re: GREP

Richard Stearn (bapwfls.wzrx@tekinteractive.net)
Thu, 08 Jan 1998 08:13:57 +0000


J. Neil Doane wrote:
>
> On Wed, 7 Jan 1998, Daniel Avila wrote:
>
> > I want to search my whole sys for a certain file ex:httpd can someone give
> > me an example for the following grep items.
> > I need to know the basics like what goes in brakets if anything at all and
> > so on
> >
> > A1. grep for a file:
>
> Why not:
> find / | grep <filename>

for a file:
find / -type f -name "<regular expression>" -print

for a directory:
find / -type d -name "<regular expression>" -print

for anything other than a filename:
find / ! -type f -name "<regular expression>" -print

Also

man find
man regexp

both worth reading and getting to grips with.

> ...for both? If you do this searching alot, try 'locate' (you may have
> to run 'updatedb' beforehand, but it makes a db and saves your drives from
> the gronking effects of running 'find's all the time.
>
> neil doane
>
> >
> >
> >
> > A2. grep for a dir:
> >
> > Thanks,
> > Daniel Avila
> >
> >

-- 
Regards
	Richard
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wsvir.jemsrmupxc@bbklaw.com       Phone +44 1666 833183      Fax +44 1666 832844
Lucent Technologies, Swindon Road, Malmesbury, Wiltshire, UK.  SN16 9NA 
Amateur radio callsign: G1SOG         Home BBS: G1SOG@GB7SDN.#49.GBR.EU
My opinions are mine, all mine. None to spare for unopinionated masses.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~