Re: using redirection (>) as part of an exec using find
From: Andrew Tkachenko (and11_at_rol.ru)
Date: 11/28/04
- Next message: KKramsch: "Re: why "" in echo "$FOO" ?"
- Previous message: chan01: "How to identify the TAR file in ksh"
- In reply to: Alex Hunsley: "Re: using redirection (>) as part of an exec using find"
- Next in thread: Alex Hunsley: "Re: using redirection (>) as part of an exec using find"
- Reply: Alex Hunsley: "Re: using redirection (>) as part of an exec using find"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 28 Nov 2004 17:36:25 +0000
Alex Hunsley wrote on 28 Ноябрь 2004 13:37:
> Bit Twister wrote:
>> On Sun, 28 Nov 2004 03:37:08 GMT, Alex Hunsley wrote:
>>
>>>I'm using antiword to convert a load of word documents into text files.
>>>So I thought I'd use the find command to locate doc files in current and
>>>all subdirs and convert them. A first bash at it (no pun intended :])
>>>looks like this:
>>>
>>> find . -name '*.doc' -exec antiword.exe {} \;
>>
>>
>> Might try xargs
>>
>> find . -type f -name "*.doc" -print | xargs antiword.exe
>
> thanks for that! haven't used xargs much before but definitely looks
useful.
> I've tried using xargs in the way you describe but things fall over
> because some of the word documents have a space character in them. xargs
> then thinks that 1 filename is actually two (it splits them at the
> space, not surprisingly). So it would appear there's two routes of attack:
>
> 1) somehow tell xargs that each whole line of input it gets is a whole
> parameter and so to escape any spaces it finds
> 2) get the find call to output the file name already escaped
>
> any ideas?
> thanks for your help!
> alex
find . -type f -name "*.doc" -print0 | xargs -r0 antiword.exe
see man for find and xargs.
-- Andrew
- Next message: KKramsch: "Re: why "" in echo "$FOO" ?"
- Previous message: chan01: "How to identify the TAR file in ksh"
- In reply to: Alex Hunsley: "Re: using redirection (>) as part of an exec using find"
- Next in thread: Alex Hunsley: "Re: using redirection (>) as part of an exec using find"
- Reply: Alex Hunsley: "Re: using redirection (>) as part of an exec using find"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|