4 examples for xargs

{{ score }}
  # find all file name ending with .pdf and remove them
find -name *.pdf | xargs rm -rf

#if file name contains spaces you shuold use this instead
find -name *.pdf | xargs -I{} rm -rf {}
{{ score }}
  # problem: my conversations with my friend Ahmed are split up across 
# irc logs across different folders

# want to find: a conversation where we were talking about "apple butter"
find ~/chatlogs -name *ahmed* | xargs grep 'apple butter'

#faster than finding a bunch of filenames, retyping them and cat * | grep apple butter
{{ score }}
  # find all UTF-8 encoded files
ls | xargs file | grep UTF-8

# find mbox unix-mail files
ls | xargs file | grep "very long lines"
{{ score }}
  # backup all files under a certain size
ls -l | awk '$5<100000 { print $NF; }' | xargs glacier upload backupfoldername