[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep -r --exclude problem
From: |
John Cowan |
Subject: |
Re: grep -r --exclude problem |
Date: |
Thu, 1 Jun 2006 12:32:56 -0400 |
User-agent: |
Mutt/1.3.28i |
Bob Proulx scripsit:
> Here is a portable way to use find to do what you want.
>
> find . \( -name '*.bak' -o -name '*.sav' -o -name '*~' \) -prune -o -print \
> | xargs grep PATTERN
>
> You might still consider it tiresome to enter them all the same as in
> grep though. In which case you would use the GNU find -regex option.
I usually avoid such complications by using a find | grep | xargs grep
pipeline, like this:
find . -type f -print |
egrep -v '(\.bak|\.sav|~)$' |
xargs grep PATTERN
--
[W]hen I wrote it I was more than a little John Cowan
febrile with foodpoisoning from an antique carrot address@hidden
that I foolishly ate out of an illjudged faith http://ccil.org/~cowan
in the benignancy of vegetables. --And Rosta