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

Re: recursive grep and openoffice



Bob Cox schrieb:
> On Mon, Mar 16, 2009 at 15:29:50 +0100, Sjoerd Hardeman (sjoerd@lorentz.leidenuniv.nl) wrote: 
> 
>> Sjoerd Hardeman wrote:
>>> What about
>>>  find . -name *.odt -exec unzip -c {} content.xml | grep "what you want 
>>> to find"\; -print
>> This one is not working, use
>>  find . -name *.odt -exec sh -c 'unzip -c {} content.xml | grep "what
>>  you want to find"' \; -print
> 
> Ingenious - but I think the *.odt needs to be within quotation marks for
> this to work, (i.e. '*.odt'). 
> 

{} should also be quoted, in case that there are file names with spaces or other
special characters. And grep (or sh) output should be redirected to dev/null:

find . -name *.odt -exec sh -c 'unzip -c "{}" content.xml | grep "what  you want
to find" > /dev/null' \; -print


Reply to: