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).