Annotation of researchv10dc/man/mana/xargs.1, revision 1.1.1.1

1.1       root        1: .TH XARGS 1
                      2: .SH NAME
                      3: xargs \- construct argument lists and execute command
                      4: .SH SYNOPSIS
                      5: .B xargs
                      6: [
                      7: .I option
                      8: ]
                      9: [
                     10: .I command
                     11: [
                     12: .I initial-arguments
                     13: ]
                     14: ]
                     15: .SH DESCRIPTION
                     16: .I Xargs\^
                     17: combines the fixed
                     18: .I initial-arguments\^
                     19: with arguments read from standard input to execute the specified
                     20: .I command\^
                     21: one or more times.
                     22: .IR Command
                     23: .RF ( /bin/echo
                     24: by default)
                     25: is located according to environment variable
                     26: .LR PATH .
                     27: .PP
                     28: Arguments read from standard input are delimited by
                     29: white space (blanks, tabs, or new-lines).
                     30: However, single or double quotes may be used to
                     31: surround arguments that contain blanks or tabs, and
                     32: backslash
                     33: .L \e
                     34: may be used to quote single characters outside of quotes.
                     35: .PP
                     36: Normally the
                     37: .I initial-arguments\^
                     38: are followed by arguments read from standard input until an internal buffer is full, whereupon
                     39: .I command\^
                     40: is executed with the accumulated arguments.
                     41: This process is repeated
                     42: until there are no more arguments.
                     43: Options modify this rule:
                     44: .TP
                     45: .BI \-l n\^
                     46: .I Command\^
                     47: is executed upon reading each
                     48: .I n\^
                     49: (default 1)
                     50: nonempty lines from standard input.
                     51: Newlines preceded by blank or tab are not counted.
                     52: Option
                     53: .B \-x
                     54: is implied.
                     55: .TP
                     56: .BI \-i s\^
                     57: Insert mode:
                     58: .I command\^
                     59: is executed for each line from standard input,
                     60: taking the entire line as a single arg, inserting it in
                     61: .I initial-arguments\^
                     62: for each occurrence of
                     63: .IR s ,
                     64: .B {\|}
                     65: by default.
                     66: Blanks and tabs at the beginning of each line are thrown away.
                     67: Constructed arguments may not exceed 255 characters.
                     68: Option
                     69: .B \-x
                     70: is implied.
                     71: .TP
                     72: .BI \-n n\^
                     73: Execute
                     74: .I command\^
                     75: using as many standard input arguments as possible, up to
                     76: .I n\^
                     77: arguments maximum.
                     78: .TP
                     79: .B \-t
                     80: Trace mode: The
                     81: .I command\^
                     82: and each constructed argument list are echoed to file descriptor 2
                     83: just prior to their execution.
                     84: .TP
                     85: .B \-p
                     86: Prompt about whether to execute
                     87: .I command.
                     88: Trace mode
                     89: .RB ( \-t )
                     90: is turned on to print the command instance to be executed,
                     91: followed by
                     92: .BR ?.\|.\|. .
                     93: The command will be executed if and only if the
                     94: reply begins with 
                     95: .LR y .
                     96: .TP
                     97: .B \-x
                     98: Terminate if any argument list would be greater than
                     99: .I size\^
                    100: characters.
                    101: .TP
                    102: .BI \-s size\^
                    103: The maximum total size of each argument list is
                    104: .I size\^
                    105: characters, 470 by default.
                    106: .TP
                    107: .BI \-e eofstr\^
                    108: .I Eofstr\^
                    109: (
                    110: .L _
                    111: by default)
                    112: is the logical end-of-file string.
                    113: Normally
                    114: .I xargs\^
                    115: reads standard input up to a logical or an actual end-of-file.
                    116: Option
                    117: .B \-e
                    118: with no
                    119: .I eofstr
                    120: turns off logical end-of-file testing.
                    121: .PP
                    122: .I Xargs\^
                    123: will terminate if it receives a return code of
                    124: .B \-1
                    125: from,
                    126: or cannot execute,
                    127: .IR command .
                    128: .SH EXAMPLES
                    129: .TP
                    130: .L
                    131: ls $1 \|| xargs \-i \-t mv $1/{\|} $2/{\|}
                    132: Move all files from directory
                    133: .L $1
                    134: to directory
                    135: .LR $2 ,
                    136: and echo each move
                    137: command just before doing it.
                    138: .TP
                    139: .L
                    140: (logname; date; echo $0 $*) | xargs >>log
                    141: Combine the output of the parenthesized commands onto one line,
                    142: which is then echoed to the end of file
                    143: .LR log .
                    144: .TP
                    145: .L
                    146: ls | xargs \-p \-l ar r arch
                    147: Ask which files in the current directory are to be archived
                    148: and archive them one at a time.
                    149: .TP
                    150: .L
                    151: ls | xargs \-p \-l | xargs ar r arch
                    152: Same, but archive many at a time.
                    153: .TP
                    154: .L
                    155: echo $** | xargs \-n2 diff
                    156: Execute
                    157: .IR diff (1)
                    158: with successive
                    159: pairs of arguments originally typed as shell arguments.
                    160: .SH "SEE ALSO"
                    161: .IR sh (1), 
                    162: .IR apply (1)
                    163: .\"    @(#)xargs.1     6.2 of 9/2/83

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.