xargs - build and execute command lines

xargs [-P max‑procs] [ ‑‑max‑procs=max‑procs] [command [common-args]] STDIN‑args
[‑i[replace‑str]] [‑‑replace[=replace‑str]]
[-l[max‑lines]] [ ‑‑max‑lines[=max‑lines]]
[‑s max‑chars] [ ‑‑max‑chars=max‑chars]
[‑n max‑args] [‑‑max‑args=max‑args]
[‑r ‑‑no-run-if-empty]
[-e[eof-str]] [ ‑‑eof[=eof-str]]
[‑p ] [‑‑interactive]
[-t ] [ ‑‑verbose]
[‑0] [‑‑null]
[ ‑‑help] [ ‑‑version]
[‑x] [‑‑exit]

STDIN‑args are delimited by blanks (unless protected with apostrophes , quotes or a backslash)
Blank lines in standard input are ignored.
default command is echo

‑‑verbose
-t
Display the constructed command on STDERR output before executing it.
‑‑interactive
-p
Prompt whether to run each command , response starts with y or Y.
Implies ‑‑verbose.
‑‑replace[=replace‑str]
‑i[replace‑str]
Use STDIN‑arg to replace occurences of replace‑str in the common arguments .
Unquoted blanks do not terminate arguments.
Default {} (like for find -exec)
Implies ‑‑exit and ‑‑max‑lines= 1.
‑‑max‑procs=max‑procs
-P max‑procs
Run up to max‑procs processes at a time; the default is 1*.
‑‑null
-0
Input filenames are terminated by a null instead of by whitespace, and the quotes and backslash are not special (every character is taken literally).
Disables the end-of-file string, which is treated like any other argument.
Useful when arguments might contain white space, quote marks, or backslashes.
The GNU find -print0 option produces input suitable for this mode.
‑‑eof[=eof-str]
-e[eof-str]
If the eof string occurs as a line of input, the rest of the input is ignored.
If eof-str is omitted, there is no end-of file string. Default _.
‑‑max‑chars=max‑chars
-s max‑chars
Use at most max‑chars characters per command line, including the command and common arguments and the terminating nulls at the ends of the argument strings. The default is as large as possible, up to 20k characters.
‑‑max‑lines[=max‑lines]
-l[max‑lines]
Use at most max‑lines nonblank input lines per command line, default 1 if max‑lines is omitted.
Trailing blanks cause an input line to be logically continued on the next input line!
Implies ‑‑exit.
‑‑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 size (see ‑‑max‑chars ) is exceeded, unless ‑‑exit is given, in which case xargs. exits.
‑‑no-run-if-empty
-r
If STDIN‑arg does not contain strings, do not run the command.
Normally, the command is run once even if there is no input.
‑‑exit
-x
Exit if the size (see ‑‑max‑chars ) is exceeded. Use ‑‑max‑args with ‑‑interactive; otherwise chances are that only one exec will be done.
‑‑help Print a summary of the options to xargs and exit.
‑‑version Print the version number of xargs and exit.

examples:

grep -l* js *.html | xargs ls {}

exit status

0 succeess
123 any invocation of the command exited with status 1-125
124 command exited with status 255
125 command is killed by a signal
126 command cannot be run
127 command is not found
1 some other error occurred.

* If max‑procs is 0(bad), xargs will run as many processes as possible at a time. This may cause the system_process_table to fillup resulting in some process (not necessarily your's) partially completing, some being skipped if the happens to be no system_process_slots available and general confusion.
If a process sub-shells a dozen times and xargs starts 100, that's 1200.

SEE find,locate,locatedb, updatedb Finding Files (on-line in Info, or printed)