
[oliver] mobility:~/1$ find . -name "file*" -printf "'%f'\n" 'file 3' 'file 2' 'file 1'
Except that will fall over on filenames with spaces in them. You want to pipe `find ... -print0` to something, most of the time. (Usually xargs(1). That’s much faster than spawning one process for every single file, too, even for a pretty small number of files.)
xargs is only useful for feeding commands that accept multiple files as arguments and do the same thing to each file (eg cat). All xargs does is take a large set of filenames/lines on standard input and break them up into smaller chunks to execute on the command line of the specified command. On a small number of files/lines xargs is likely to only execute the target command once. xargs can also suffer (as stated in the man page) from the same space \new line issues of bash. Though you can tell it to split on NULL which is nice as it plays well with find -print0 as you suggest. Regards -- Oliver Jones <oliver(a)deeperdesign.com> Deeper Design