2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00
cheat.sheets/sheets/xargs
2017-05-25 16:48:40 +00:00

21 lines
647 B
Plaintext

# find all file name ending with .pdf and remove them
find -name \*.pdf | xargs rm
# find all file name ending with .pdf and remove them
# (bulletproof version: handles filenames with \n and skips *.pdf directories)
# -r = --no-run-if-empty
# -n10 = group by 10 files
find -name \*.pdf -type f -print0 | xargs -0rn10
# 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 '&{}='
# group words by three in a string
seq 1 10 | xargs -n3 echo