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