find a file

Pete Holsberg pjh42 at
Sun Aug 12 17:11:06 UTC 2007

Brian McKee keyed the following on 8/12/2007 12:01 PM:
>  On Mon, 2007-06-08 at 08:12 -0400, John Dangler wrote:
> > As to the secondary question regarding grep, to find a specific
> > word in a file (or files) in a directory, I usually do this little
> > shell script, typed at the commandline- for word in `ls` do cat
> > $word | grep "searchword" done
> >
> > That will search each file in a directory and tell you which files
> > have the word you want (if any)
> >
> > I wouldn't recommend this for extremely large directories (or an
> > entire disk).
>  Grep has a recursive option - save your typing :-)
>  grep $word -r $directory
>  HTH Brian

Is that a GNU enhancement? It wasn't in SVR4 or Solaris as far as I can 

Pete Holsberg
Columbus, NJ

Age is not a particularly interesting subject. Anyone can get old. All 
you have to do is live long enough...
--Groucho Marx

More information about the ubuntu-users mailing list