Any reason this is off list? List cc:'ed in response. on Mon, Oct 30, 2000 at 04:24:36AM -0900, Ethan Benson ([EMAIL PROTECTED]) wrote: > On Mon, Oct 30, 2000 at 03:16:32AM -0800, kmself@ix.netcom.com wrote: > > I prefer: > > > > $ find . -type f -print0 | xargs --null zgrep -l pattern > > > > ...though as noted, the "grep -r" construct is simpler when pattern > > matching of filenames isn't required of find. > > > > The "-print0" and "--null" switches allow matching of filenames with > > spaces in them, should any occur, by using an ASCII null as a delimiter > > rather than whitespace. > > hmm is there any way to do that print0 hack with ls or something?
Note that it's not a hack, it's a set of switches on both the find and xargs commands. That's different. > i had an account an a MacOSX box and was trying to run some security > auditing of my own on it to see how many times Apple fscked up but > there find is broken and there is crap in / with embeded spaces in the > filenames. > > first there find when started from / dies as soon as it gets a > permission error (which happens immediatly because of a bogus .vol > dir thing apple created with r but x permissions. the hack i was > using to get around it was > > /bin/sh > cd / > for i in `ls` ; do find $i blah blah blah ; done How about instead you do something where you know you're going to get one filename per line, and manipulate these with shell tools or Perl? The simpilest thing to do would be: $ ls -1 What to do from here becomes an interesting problem. If I'm doing a one-off, I'll usually dump the output to a temporary file, run shell edits on it in vi or sed until I get what I want, then execute the results. You could do things this way, or work out what edits you have to make, script them, and output a /tmp file with some arbitrary random name, run it, and remove it, within a script. The clever option would be to do the rewrite and run that as a here document. Say: #!/bin/sh sh -f <<EOF $( ls -1 | sed -e '/.*/find "$*" blah blah blah'/ EOF ...which I think will work, or at least get you moving in the right direction. -- Karsten M. Self <kmself@ix.netcom.com> http://www.netcom.com/~kmself Evangelist, Opensales, Inc. http://www.opensales.org What part of "Gestalt" don't you understand? There is no K5 cabal http://gestalt-system.sourceforge.net/ http://www.kuro5hin.org
pgpWqW9IUcOSJ.pgp
Description: PGP signature