On Wed, Mar 18, 2009 at 11:19:20AM -0500, Boyd Stephen Smith Jr. wrote: > In <1f1816a90903180556k56e3e592qa14c55d1c3193...@mail.gmail.com>, John O > Laoi wrote: > >With respect to the command line, I have fixed on > > > > find . -name *.odt -exec sh -c 'unzip -c "{}" content.xml | grep > >"string-being sought" > /dev/null' \; -print > > I think I'd rewrite it as: > find . \ > -name '*.odt' \ > -exec sh -c 'unzip -c "$1" content.xml | grep -q regex' \{} \; \ > -print > > I'm not sure what the rules are for find substituting "{}" within another > argument, so it seems best to write it as a separate argument. If you have > anything that matches *.odt in the current directory, the find won't work[1] > unless you quote it. You might also need to throw double-quotes around the > regex, depending on its contents. > ... > > [1] It may work, but it won't actually be searching for files with names > matching the glob *.odt. It _may_ also work if unquoted, since bash will leave the literal * as is if there's no match in the current directory, and so find will see it as intended. I guess that's a good thing, but it can be confusing.
Bash will also leave {} untouched since it doesn't expand to anything, so I don't see any point in quoting it as shown. Ken -- Ken Irving -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org