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

Re: recursive grep and openoffice



In <[🔎] 1f1816a90903180556k56e3e592qa14c55d1c3193026@mail.gmail.com>, John O 
Laoi wrote:
>Thanks for all of your replies.
>I didn't know that tools such as tracker would search with openoffice
>document.
>
>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. 
-- 
Boyd Stephen Smith Jr.           	 ,= ,-_-. =.
bss@iguanasuicide.net            	((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy 	 `-'(. .)`-'
http://iguanasuicide.net/        	     \_/

[1] It may work, but it won't actually be searching for files with names 
matching the glob *.odt.

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: