On 2004-12-12 22:32:06 +0000 Brett Parker iDunno@sommitrealweird.co.uk wrote:
On Sun, Dec 12, 2004 at 06:10:30PM +0000, Graham wrote:
[...] only works if the files don't have spaces in their names; "for" breaks them up into space-delimited tokens, which is no use at all. How do I do this (apparently) simple thing?
I'd solve it with find (and printf), sort, cut, and then xargs. [...]
Brett's solution is probably better/safer, but my first thought was that it's not "for" splitting them on spaces, but bash (or whatever your shell is). You could probably stop it by changing the value of the IFS environment variable from its default of space tab newline to just newline. Of course, this will break if a filename has a newline in it, but Brett's won't if you use \0 (the null character) as the delimiter.