[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to find files by text/subdirectories



Ralph Winslow wrote:
  >Anthony Campbell wrote:
  >> 
  >> On 07 Feb 1999q, Lance Hoffmeyer wrote:
  >> > What is the easiest way to locates files (say HTML) by text in their
  >> > documents? 
  >
  >find director_and_subs_you_are_interested_in -exec grep "string you
  >seek" {} \; -print
 
That would be rather slow, because you would start a new grep process
for every file in the find list.  You would also pick up directories and
even device files, which you probably would not want to do.

This command, while essentially doing the same thing, will be faster
and cleaner:

  find directory_list -type f | xargs grep 'search_pattern'


find is a very useful program, with many options.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "The heavens declare the glory of God; and the  
      firmament showeth his handiwork."          Psalms 19:1



Reply to: