xargs when the filename contains a newline
Answer:
It is always handy to combine the power of find and xargs for a lot of tasks, such as
# find /tmp -type f | xargs rm -rf
However, the command will failed if the a file contains a newline character. To solve this, you can do like below.
# find /tmp -type f -print0 | xargs -0 rm -rf
Now the file list returned by the find command is terminated by a null character, so it will not mixed with the newline character if they are part of the filename. Also, the xargs -0 option will treat the null character as the delimiter (rather than newline).


Linux is very line oriented. xargs is an odd child in this respect as it deals badly with white space, ' and ".
GNU Parallel http://www.gnu.org/software/parallel/ may be a better choice as it is designed to be line oriented.
Watch the intro video to GNU Parallel: http://www.youtube.com/watch?v=OpaiGYxkSuQ