xargs(1) - SerenityOS man pages

#Name

xargs - build and execute commandlines from input

#Synopsis

$ xargs [options...] [command [initial-arguments...]]

#Description

xargs reads items from a stream, delimited by some blank character (delimiter), and executes the command as many times as there are items, with any processed initial-arguments, possibly followed by a number of items read from the input.

If a placeholder is explicitly specified, the max-lines limit is set to 1, and each argument in initial-arguments is processed by replacing any occurrence of the placeholder with the input item, and treating the entire resulting value as one argument.

It is to be noted that command is also subject to substitution in this mode.

If no argument in command or initial-arguments contains the placeholder, an argument is added at the end of the list containing only the placeholder.

If a placeholder is not explicitly specified, no substitution will be performed, rather, the item(s) will be appended to the end of the command line, until either of the following conditions are met:

xargs will read the items from standard input by default, and when data is read from standard input, the standard input of command is redirected to read from /dev/null. The standard input is left as-is if data is read from a file.

#Options

#Examples

$ pro http://list-of-example-urls.com/plain | xargs -I 'URL' pro URL > concatenated-outputs
$ xargs -a list-of-files-to-delete --verbose rm
$ xargs -a list-of-moves -L 2 mv
$ xargs -a stuff --null -s 1024

#See also