From 6af70575943148aa028c9ef35652e5b6b929ef35 Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Thu, 25 May 2017 10:22:44 +0000 Subject: [PATCH] fixed xargs errors + added own examples --- sheets/xargs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sheets/xargs diff --git a/sheets/xargs b/sheets/xargs new file mode 100644 index 0000000..b0e37aa --- /dev/null +++ b/sheets/xargs @@ -0,0 +1,14 @@ +# find all file name ending with .pdf and remove them +find -name \*.pdf | xargs rm + +# 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