10 Matching Annotations
- Feb 2024
-
unix.stackexchange.com unix.stackexchange.com
-
The input format of the xargs command doesn't match what any other command produces.
-
The input format of the xargs command doesn't match what any other command produces. Yes, it's bizarre. With -I, xargs ignores indentation, which is why the file names with initial spaces are mangled. Do not use xargs except with the -0 option or when you know your input doesn't contain characters that would confuse it.
-
-
stackoverflow.com stackoverflow.com
-
find . -maxdepth 1 -mindepth 1 | xargs -d'\n'
-
Do not use xargs without -d when you do not want ' " \ to be handled specially.
-
- Jun 2023
-
stackoverflow.com stackoverflow.com
-
xargs -n 1 -I% git push origin :refs/tags/%
-
- Sep 2021
-
stackoverflow.com stackoverflow.com
-
One good use for /dev/tty is if you're trying to call an editor in a pipeline (e.g., with xargs). Since the standard input of xargs is some list of files rather than your terminal, just doing, e.g., | xargs emacs will screw up your terminal. Instead you can use | xargs sh -c 'emacs "$@" </dev/tty' emacs to connect the editor to your terminal even though the input of xargs is coming from elsewhere.
-
- Dec 2020
-
www.cloudsavvyit.com www.cloudsavvyit.com
-
Here we used two xargs commands. The first one builds a custom command line, using as input the output of the previous command in the pipe (being pidof sleep) and the second xargs command executes that generated, custom-per-input (important!), command.
xargs | xargs
-
- Aug 2020
-
stackoverflow.com stackoverflow.com
-
The easiest way to do what the original poster wants is to change the delimiter from any whitespace to just the end-of-line character like this: find whatever ... | xargs -d "\n" cp -t /var/tmp
-
Speed example -- over 829 files, the "find -exec" method took 26 seconds while the "find -print0 | xargs --null" method tool 0.7 seconds. Significant difference.
-
- Apr 2020