Re: using redirection (>) as part of an exec using find
From: Alex Hunsley (lard_at_tardis.ed.ac.molar.uk)
Date: 11/28/04
- Next message: Bill Marcum: "Re: how to use sed to replace a single occurrence in a file"
- Previous message: Andrew Tkachenko: "Re: how to use sed to replace a single occurrence in a file"
- In reply to: Andrew Tkachenko: "Re: using redirection (>) as part of an exec using find"
- Next in thread: Erik Max Francis: "Re: using redirection (>) as part of an exec using find"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 28 Nov 2004 19:24:23 GMT
Andrew Tkachenko wrote:
> 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.
>
thanks muchly! This does just the trick.
alex
- Next message: Bill Marcum: "Re: how to use sed to replace a single occurrence in a file"
- Previous message: Andrew Tkachenko: "Re: how to use sed to replace a single occurrence in a file"
- In reply to: Andrew Tkachenko: "Re: using redirection (>) as part of an exec using find"
- Next in thread: Erik Max Francis: "Re: using redirection (>) as part of an exec using find"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|