xargs.1 (79297) | xargs.1 (95080) |
---|---|
1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" John B. Roll Jr. and the Institute of Electrical and Electronics 6.\" Engineers, Inc. 7.\" 8.\" Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 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 34.\" SUCH DAMAGE. 35.\" 36.\" @(#)xargs.1 8.1 (Berkeley) 6/6/93 | 1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" John B. Roll Jr. and the Institute of Electrical and Electronics 6.\" Engineers, Inc. 7.\" 8.\" Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 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 34.\" SUCH DAMAGE. 35.\" 36.\" @(#)xargs.1 8.1 (Berkeley) 6/6/93 |
37.\" $FreeBSD: head/usr.bin/xargs/xargs.1 79297 2001-07-05 08:51:08Z dd $ | 37.\" $FreeBSD: head/usr.bin/xargs/xargs.1 95080 2002-04-19 23:28:54Z jmallett $ 38.\" $xMach: xargs.1,v 1.2 2002/02/23 05:23:37 tim Exp $ |
38.\" 39.Dd May 7, 2001 40.Dt XARGS 1 41.Os 42.Sh NAME 43.Nm xargs 44.Nd "construct argument list(s) and execute utility" 45.Sh SYNOPSIS 46.Nm | 39.\" 40.Dd May 7, 2001 41.Dt XARGS 1 42.Os 43.Sh NAME 44.Nm xargs 45.Nd "construct argument list(s) and execute utility" 46.Sh SYNOPSIS 47.Nm |
47.Op Fl 0 | 48.Op Fl 0pt 49.Op Fl E Ar eofstr 50.Op Fl I Ar replstr |
48.Op Fl J Ar replstr | 51.Op Fl J Ar replstr |
52.Op Fl L Ar number |
|
49.Oo 50.Fl n Ar number 51.Op Fl x 52.Oc 53.Op Fl s Ar size | 53.Oo 54.Fl n Ar number 55.Op Fl x 56.Oc 57.Op Fl s Ar size |
54.Op Fl t | |
55.Op Ar utility Op Ar argument ... 56.Sh DESCRIPTION 57The 58.Nm 59utility reads space, tab, newline and end-of-file delimited arguments 60from the standard input and executes the specified 61.Ar utility 62with them as --- 24 unchanged lines hidden (view full) --- 87.Nm 88to expect NUL 89(``\\0'') 90characters as separators, instead of spaces and newlines. 91This is expected to be used in concert with the 92.Fl print0 93function in 94.Xr find 1 . | 58.Op Ar utility Op Ar argument ... 59.Sh DESCRIPTION 60The 61.Nm 62utility reads space, tab, newline and end-of-file delimited arguments 63from the standard input and executes the specified 64.Ar utility 65with them as --- 24 unchanged lines hidden (view full) --- 90.Nm 91to expect NUL 92(``\\0'') 93characters as separators, instead of spaces and newlines. 94This is expected to be used in concert with the 95.Fl print0 96function in 97.Xr find 1 . |
98.It Fl E Ar eofstr 99Use 100.Ar eofstr 101as a logical EOF marker. 102.It Fl I Ar replstr 103Execute 104.Ar utility 105for each input line, replacing one or more occurences of 106.Ar replstr 107in up to 5 arguments to 108.Ar utility 109with the entire line of input. 110The resulting arguments after replacement is done will not be allowed to grow 111beyond 255 bytes, this is implemented by concatenating as much of the argument 112containing 113.Ar replstr 114as possible to the constructed arguments to 115.Ar utility 116up to 255 bytes. 117The 255 byte limit does not apply to arguments to 118.Ar utility 119which do not contain 120.Ar replstr , 121and furthermore no replacement will be done on 122.Ar utility 123itself. 124Implies 125.Fl x . |
|
95.It Fl J Ar replstr 96If this option is specified, 97.Nm 98will use the data read from standard input to replace the first occurrence of 99.Ar replstr 100instead of appending that data after all other arguments. 101This option will not effect how many arguments will be read from input 102.Pq Fl n , --- 16 unchanged lines hidden (view full) --- 119will be replaced. 120For example, the following command will copy the list of files and 121directories which start with an uppercase letter in the current 122directory to 123.Pa destdir : 124.Pp 125.Dl /bin/ls -1d [A-Z]* | xargs -J [] cp -rp [] destdir 126.Pp | 126.It Fl J Ar replstr 127If this option is specified, 128.Nm 129will use the data read from standard input to replace the first occurrence of 130.Ar replstr 131instead of appending that data after all other arguments. 132This option will not effect how many arguments will be read from input 133.Pq Fl n , --- 16 unchanged lines hidden (view full) --- 150will be replaced. 151For example, the following command will copy the list of files and 152directories which start with an uppercase letter in the current 153directory to 154.Pa destdir : 155.Pp 156.Dl /bin/ls -1d [A-Z]* | xargs -J [] cp -rp [] destdir 157.Pp |
158.It Fl L Ar number 159Calls 160.Ar utility 161for every 162.Ar number 163lines read. 164If EOF is reached and fewer lines have been read than 165.Ar number 166then 167.Ar utility 168will be called with the available lines. |
|
127.It Fl n Ar number 128Set the maximum number of arguments taken from standard input for each 129invocation of the utility. 130An invocation of 131.Ar utility 132will use less than 133.Ar number 134standard input arguments if the number of bytes accumulated (see the 135.Fl s 136option) exceeds the specified 137.Ar size 138or there are fewer than 139.Ar number 140arguments remaining for the last invocation of 141.Ar utility . 142The current default value for 143.Ar number 144is 5000. | 169.It Fl n Ar number 170Set the maximum number of arguments taken from standard input for each 171invocation of the utility. 172An invocation of 173.Ar utility 174will use less than 175.Ar number 176standard input arguments if the number of bytes accumulated (see the 177.Fl s 178option) exceeds the specified 179.Ar size 180or there are fewer than 181.Ar number 182arguments remaining for the last invocation of 183.Ar utility . 184The current default value for 185.Ar number 186is 5000. |
187.It Fl p 188Echo each command to be executed and ask the user whether it should be 189executed. 190A response of 191.Ql y 192causes the command to be executed, any other response causes it to be 193skipped. |
|
145.It Fl s Ar size 146Set the maximum number of bytes for the command line length provided to 147.Ar utility . 148The sum of the length of the utility name, the arguments passed to 149.Ar utility 150(including 151.Dv NULL 152terminators) and the current environment will be less than or equal to --- 26 unchanged lines hidden (view full) --- 179.Pp 180The 181.Nm 182utility exits immediately (without processing any further input) if a 183command line cannot be assembled, 184.Ar utility 185cannot be invoked, an invocation of the utility is terminated by a signal 186or an invocation of the utility exits with a value of 255. | 194.It Fl s Ar size 195Set the maximum number of bytes for the command line length provided to 196.Ar utility . 197The sum of the length of the utility name, the arguments passed to 198.Ar utility 199(including 200.Dv NULL 201terminators) and the current environment will be less than or equal to --- 26 unchanged lines hidden (view full) --- 228.Pp 229The 230.Nm 231utility exits immediately (without processing any further input) if a 232command line cannot be assembled, 233.Ar utility 234cannot be invoked, an invocation of the utility is terminated by a signal 235or an invocation of the utility exits with a value of 255. |
187.Pp | 236.Sh DIAGNOSTICS |
188The 189.Nm 190utility exits with a value of 0 if no error occurs. 191If 192.Ar utility | 237The 238.Nm 239utility exits with a value of 0 if no error occurs. 240If 241.Ar utility |
193cannot be invoked, | 242cannot be found, |
194.Nm | 243.Nm |
195exits with a value of 127. | 244exits with a value of 127, otherwise if 245.Ar utility 246cannot be executed, 247.Nm 248exits with a value of 126. |
196If any other error occurs, 197.Nm 198exits with a value of 1. 199.Sh SEE ALSO 200.Xr echo 1 , 201.Xr find 1 , 202.Xr execvp 3 203.Sh STANDARDS --- 18 unchanged lines hidden --- | 249If any other error occurs, 250.Nm 251exits with a value of 1. 252.Sh SEE ALSO 253.Xr echo 1 , 254.Xr find 1 , 255.Xr execvp 3 256.Sh STANDARDS --- 18 unchanged lines hidden --- |