home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / question / 10167 < prev    next >
Encoding:
Internet Message Format  |  1992-08-18  |  1.1 KB

  1. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!jvnc.net!yale.edu!yale!gumby!wmichgw!754clifton
  2. From: 754clifton@gw.wmich.edu
  3. Newsgroups: comp.unix.questions
  4. Subject: Using find w/ -exec and -ls
  5. Message-ID: <1992Aug18.203042.5003@gw.wmich.edu>
  6. Date: 18 Aug 92 20:30:42 EST
  7. Organization: Western Michigan University
  8. Lines: 18
  9.  
  10. I'm trying to use find with [fe]grep to find all files of a certain extension
  11. that contain a string or regex and then print their names only in a ls -l
  12. format. The problem I am having is that _all_ the files are printed rather
  13. than just the ones that return 0 from grep. This is what I tried:
  14.  
  15.     % find / -type f -name \*.ext -exec grep -s regex \{\} \; -ls
  16.  
  17. What am I doing wrong? The only solution I've been able to come up with is to
  18. us xargs to pipe (replace grep -s w/ -l) the output of above minus the -ls
  19. switch to the real ls program. However, in the situation that I want to use this
  20. command line, pipes are not feasable. Also using a pipe to xargs slows this
  21. (already slow) command down.
  22.  
  23. Anyone?
  24.  
  25. /Doug
  26. --
  27. Douglas Clifton [99clifto@lab.cc.wmich.edu] 
  28.