[XARGS] Add xargs example

This commit is contained in:
ImmortalPC 2014-03-10 21:47:19 +01:00
parent c0a51a2d0f
commit b2e5f6d2cf

12
cheatsheets/xargs Normal file
View File

@ -0,0 +1,12 @@
# find all file name ending with .pdf and remove them
find -name *.pdf | xargs rm -rf
# if file name contains spaces you should use this instead
find -name *.pdf | xargs -I{} rm -rf '{}'
# Will show every .pdf like:
# &toto.pdf=
# &titi.pdf=
# -n1 => One file by one file. ( -n2 => 2 files by 2 files )
find -name *.pdf | xargs -I{} -n1 echo '&{}='