Subject: Re: find uses 400MB memory
To: Kazushi Marukawa (Jam) <email@example.com>
From: David Burren <firstname.lastname@example.org>
Date: 09/15/2001 09:29:30
> On the other hand, thank you for introducing xargs.
> However, xargs has a problem for me. It tries to parse not
> only arguments but also file names through stdin.
> Therefore, it stops with "unterminated quote" message if
> some files using one single/double quote in its file name.
> I'm not sure whether this is a bug or specification though.
> It's the reason why I didn't use it.
It's normal. xargs uses whitespace to delimit its incoming filenames.
Both find and xargs (at least in NetBSD and FreeBSD) have arguments
to help you work around this situation. Take Simon's example:
find . -type f -print | xargs crc-calc-program
Instead, use this:
find . -type f -print0 | xargs -0 crc-calc-program
Find's -print0 uses a NUL character instead of a newline to delimit
its output, and xargs -0 uses a NUL instead of whitespace to delimit
Certainly I use this all the time to cope with filenames with weird
characters in them. Of course, crc-calc-program should be able to
cope with these filenames also...
Hope this helps