1 .\" Copyright (c) 1990, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" This code is derived from software contributed to Berkeley by
5 .\" John B. Roll Jr. and the Institute of Electrical and Electronics
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
16 .\" 3. All advertising materials mentioning features or use of this software
17 .\" must display the following acknowledgement:
18 .\" This product includes software developed by the University of
19 .\" California, Berkeley and its contributors.
20 .\" 4. Neither the name of the University nor the names of its contributors
21 .\" may be used to endorse or promote products derived from this software
22 .\" without specific prior written permission.
24 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 .\" @(#)xargs.1 8.1 (Berkeley) 6/6/93
37 .\" $FreeBSD: src/usr.bin/xargs/xargs.1,v 1.6.2.12 2003/06/01 21:40:35 mux Exp $
38 .\" $DragonFly: src/usr.bin/xargs/xargs.1,v 1.3 2004/03/11 12:28:58 hmp Exp $
39 .\" $xMach: xargs.1,v 1.2 2002/02/23 05:23:37 tim Exp $
46 .Nd "construct argument list(s) and execute utility"
53 .Op Fl R Ar replacements
62 .Op Ar utility Op Ar argument ...
66 utility reads space, tab, newline and end-of-file delimited strings
67 from the standard input and executes
72 Any arguments specified on the command line are given to
74 upon each invocation, followed by some number of the arguments read
75 from the standard input of
78 is repeatedly executed until standard input is exhausted.
80 Spaces, tabs and newlines may be embedded in arguments using single
82 or double (``"'') quotes or backslashes (``\e'').
83 Single quotes escape all non-single quote characters, excluding newlines,
84 up to the matching single quote.
85 Double quotes escape all non-double quote characters, excluding newlines,
86 up to the matching double quote.
87 Any single character, including newlines, may be escaped by a backslash.
89 The options are as follows:
90 .Bl -tag -width indent
96 characters as separators, instead of spaces and newlines.
97 This is expected to be used in concert with the
104 as a logical EOF marker.
108 for each input line, replacing one or more occurrences of
114 flag is specified) arguments to
116 with the entire line of input.
117 The resulting arguments, after replacement is done, will not be allowed to grow
118 beyond 255 bytes; this is implemented by concatenating as much of the argument
121 as possible, to the constructed arguments to
124 The 255 byte limit does not apply to arguments to
128 and furthermore, no replacement will be done on
134 If this option is specified,
136 will use the data read from standard input to replace the first occurrence of
138 instead of appending that data after all other arguments.
139 This option will not effect how many arguments will be read from input
141 or the size of the command(s)
145 The option just moves where those arguments will be placed in the command(s)
149 must show up as a distinct
153 It will not be recognized if, for instance, it is in the middle of a
155 Furthermore, only the first occurrence of the
158 For example, the following command will copy the list of files and
159 directories which start with an uppercase letter in the current
163 .Dl /bin/ls -1d [A-Z]* | xargs -J % cp -rp % destdir
171 If EOF is reached and fewer lines have been read than
175 will be called with the available lines.
177 Set the maximum number of arguments taken from standard input for each
184 standard input arguments if the number of bytes accumulated (see the
186 option) exceeds the specified
188 or there are fewer than
190 arguments remaining for the last invocation of
192 The current default value for
198 in the child process before executing the command.
199 This is useful if you want
201 to run an interactive application.
203 Echo each command to be executed and ask the user whether it should be
205 An affirmative response,
208 causes the command to be executed, any other response causes it to be
210 No commands are executed if the process is not attached to a terminal.
211 .It Fl R Ar replacements
212 Specify the maximum number of arguments that
214 will do replacement in.
216 Set the maximum number of bytes for the command line length provided to
218 The sum of the length of the utility name, the arguments passed to
222 terminators) and the current environment will be less than or equal to
224 The current default value for
230 Echo the command to be executed to standard error immediately before it
235 to terminate immediately if a command line containing
237 arguments will not fit in the specified (or default) command line length.
246 Undefined behavior may occur if
248 reads from the standard input.
252 utility exits immediately (without processing any further input) if a
253 command line cannot be assembled,
255 cannot be invoked, an invocation of
257 is terminated by a signal,
260 exits with a value of 255.
264 utility exits with a value of 0 if no error occurs.
269 exits with a value of 127, otherwise if
273 exits with a value of 126.
274 If any other error occurs,
276 exits with a value of 1.
284 utility is expected to be
291 options are non-standard
293 extensions which may not be available on other operating systems.
297 command appeared in PWB UNIX.
301 attempts to invoke another command such that the number of arguments or the
302 size of the environment is increased, it risks