10 Matching Annotations
  1. Feb 2024
    1. The input format of the xargs command doesn't match what any other command produces.
    2. 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.
  2. Jun 2023
  3. Sep 2021
    1. 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.
  4. Dec 2020
    1. 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

  5. Aug 2020
    1. 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
    2. 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.
  6. Apr 2020