Table of Contents
reads arguments from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or newlines, and executes the command (default is /bin/echo) one or more times with any initial-arguments fol- lowed by arguments read from standard input. Blank lines on the standard input are ignored.
>echo * | xargs echo asciiart.tar.gz assn.tar.gz bin.tgz doc.tar.gz
>echo * | xargs -n 1 echo asciiart.tar.gz assn.tar.gz bin.tgz doc.tar.gz
--replace[=replace-str], -i[replace-str] Replace occurences of replace-str in the initial arguments with names read from standard input. Also, unquoted blanks do not terminate arguments. If replace-str is omitted, it defaults to "{}" (like for `find -exec'). Implies -x and -l 1.
--max-lines[=max-lines], -l[max-lines] Use at most max-lines nonblank input lines per command line; max-lines defaults to 1 if omitted. Trailing blanks cause an input line to be logically continued on the next input line. Implies -x.
--max-args=max-args, -n max-args Use at most max-args arguments per command line. Fewer than max-args arguments will be used if the size (see the -s option) is exceeded, unless the -x option is given, in which case xargs will exit.
-t Enable trace mode. Each generated command line will be written to standard error just prior to invocation.
$ echo `jot 3` | xargs -n 1 -i echo {} {} 1 2 3 1 2 3
$ jot 3 | xargs -i -n 1 echo {} {} {} {} 1 {} {} 2 {} {} 3
$ jot 3 | xargs -i echo {} {} 1 1 2 2 3 3
— Use above, 'ls -1 | xargs -i' !!,
$ ls ind* | xargs -i echo mv {} _{} mv index.html _index.html mv index001.html _index001.html
— no -1 will also do!!! <<:Thu 06-24-99:>>
*N*: If you have to use echo, use this (Sun 03-14-99) echo * | xargs -n 1 | xargs -i echo {} {}
alias xargsi="tr '\n' '\0' | xargs -0 -i"
— the same as alias xargsi="xargs -i"
alias xargs1="tr '\n' '\0' | xargs -0 -n 1"
— the same as alias xargsi="xargs -l 1"