*- On 10 Oct, Enrico Zini wrote about "Re: find | egrep" > > On Mon, 11 Oct 1999 [EMAIL PROTECTED] wrote: > >> Not a debian question, moreso a generic Unix question.. I need to be able >> to use find and egrep to scan a directory which has more than 3000 files in >> it. I read in the manual ie "man egrep" that the lines are limited to 2048 >> bytes. The error i get is "/usr/bin/find: 0403-027 The parameter list is >> too long." Is there any way i can work around this? > > There's more than one way to do it(tm): > > find <options> | xargs egrep "pattern" > find <options> | while read a; do egrep "pattern" $a; done > [...] > find <options> -exec egrep "pattern" {} \; > > The latter being the preferred one. >
There is also rgrep, the recursive grep'er. It can do basic filename pattern matching. An example from the man page. Look in all files with a 'c' extension in current direc- tory and all its subdirectories looking for matches of 'int ' at the beginning of a line, printing the line con- taining the match with its line number: (two methods) rgrep -n -R '*.c' '^int ' . rgrep -n -x c '^int ' . -- Brian Servis -- ------------------------------------------------------------------------ Mechanical Engineering | Never criticize anybody until you Purdue University | have walked a mile in their shoes, [EMAIL PROTECTED] | because by that time you will be a http://www.ecn.purdue.edu/~servis | mile away and have their shoes.