grep'ing tips (was: Re: [NTLUG:Discuss] tap[0-9]* modules? )
Chris Cox
cjcox at acm.org
Sun Dec 12 22:13:05 CST 1999
Rusty Haddock wrote:
>
> Rick Cook wrote:
> >
> >>> As is so common with Unixes (or Uni?) there is yet another way to handle
> >>> this situation. Try out the following (which doesn't include backticks):
> >>>
> >>> find . -type f -print | xargs egrep tap0
> >
> >or, alternatively:
> >
> > find . -type f -exec egrep tap0 {} \;
> >
> >This way, egrep gets one filename at a time...
>
> For a small number of files, this would be OK, but I wouldn't want "egrep"
> to start up 10,000 times, once for each of my files -- cache or no cache.
Doesn't work that way....grep will be invoked on a set of files....read
the manpage.
If you want to fire up grep for each file you'll need the -n1 parameter.
Regards,
Chris
More information about the Discuss
mailing list