Index: head/usr.bin/jot/jot.1 =================================================================== --- head/usr.bin/jot/jot.1 (revision 281208) +++ head/usr.bin/jot/jot.1 (revision 281209) @@ -1,326 +1,328 @@ .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)jot.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 2, 2010 +.Dd April 7, 2015 .Dt JOT 1 .Os .Sh NAME .Nm jot .Nd print sequential or random data .Sh SYNOPSIS .Nm .Op Fl cnr .Op Fl b Ar word .Op Fl w Ar word .Op Fl s Ar string .Op Fl p Ar precision .Op Ar reps Op Ar begin Op Ar end Op Ar s .Sh DESCRIPTION The .Nm utility is used to print out increasing, decreasing, random, or redundant data, usually numbers, one per line. .Pp The following options are available: .Bl -tag -width indent .It Fl r Generate random data instead of the default sequential data. .It Fl b Ar word Just print .Ar word repetitively. .It Fl w Ar word Print .Ar word with the generated data appended to it. Octal, hexadecimal, exponential, .Tn ASCII , zero padded, and right-adjusted representations are possible by using the appropriate .Xr printf 3 conversion specification inside .Ar word , in which case the data are inserted rather than appended. .It Fl c This is an abbreviation for .Fl w Ar %c . .It Fl s Ar string Print data separated by .Ar string . Normally, newlines separate data. .It Fl n Do not print the final newline normally appended to the output. .It Fl p Ar precision Print only as many digits or characters of the data as indicated by the integer .Ar precision . In the absence of .Fl p , the precision is the greater of the precisions of .Ar begin and .Ar end . The .Fl p option is overridden by whatever appears in a .Xr printf 3 conversion following .Fl w . .El .Pp The last four arguments indicate, respectively, the number of data, the lower bound, the upper bound, and the step size or, for random data, the seed. While at least one of them must appear, any of the other three may be omitted, and will be considered as such if given as .Fl "" or as an empty string. Any three of these arguments determines the fourth. If four are specified and the given and computed values of .Ar reps conflict, the lower value is used. If fewer than three are specified, defaults are assigned left to right, except for .Ar s , which assumes a default of 1 or -1 if both .Ar begin and .Ar end are given. .Pp Defaults for the four arguments are, respectively, 100, 1, 100, and 1, except that when random data are requested, the seed, .Ar s , is picked randomly. The .Ar reps argument is expected to be an unsigned integer, and if given as zero is taken to be infinite. The .Ar begin and .Ar end arguments may be given as real numbers or as characters representing the corresponding value in .Tn ASCII . The last argument must be a real number. .Pp Random numbers are obtained through .Xr arc4random 3 when no seed is specified, and through .Xr random 3 when a seed is given. When .Nm is asked to generate random integers or characters with begin and end values in the range of the random number generator function and no format is specified with one of the .Fl w , .Fl b , or .Fl p options, .Nm will arrange for all the values in the range to appear in the output with an equal probability. In all other cases be careful to ensure that the output format's rounding or truncation will not skew the distribution of output values in an unintended way. .Pp The name .Nm derives in part from .Nm iota , a function in APL. .Ss Rounding and truncation The .Nm utility uses double precision floating point arithmetic internally. Before printing a number, it is converted depending on the output format used. .Pp If no output format is specified or the output format is a floating point format .Po .Sq E , .Sq G , .Sq e , .Sq f , or .Sq g .Pc , the value is rounded using the .Xr printf 3 function, taking into account the requested precision. .Pp If the output format is an integer format .Po .Sq D , .Sq O , .Sq U , .Sq X , .Sq c , .Sq d , .Sq i , .Sq o , .Sq u , or .Sq x .Pc , the value is converted to an integer value by truncation. .Pp As an illustration, consider the following command: .Bd -literal -offset indent $ jot 6 1 10 0.5 1 2 2 2 3 4 .Ed .Pp By requesting an explicit precision of 1, the values generated before rounding can be seen. The .5 values are rounded down if the integer part is even, up otherwise. .Bd -literal -offset indent $ jot -p 1 6 1 10 0.5 1.0 1.5 2.0 2.5 3.0 3.5 .Ed .Pp By offsetting the values slightly, the values generated by the following command are always rounded down: .Bd -literal -offset indent $ jot -p 0 6 .9999999999 10 0.5 1 1 2 2 3 3 .Ed .Pp Another way of achieving the same result is to force truncation by specifying an integer format: .Bd -literal -offset indent $ jot -w %d 6 1 10 0.5 .Ed .Sh EXIT STATUS .Ex -std .Sh EXAMPLES The command .Dl jot - 1 10 .Pp prints the integers from 1 to 10, while the command .Dl jot 21 -1 1.00 .Pp prints 21 evenly spaced numbers increasing from -1 to 1. The .Tn ASCII character set is generated with .Dl jot -c 128 0 .Pp and the strings xaa through xaz with .Dl jot -w xa%c 26 a .Pp while 20 random 8-letter strings are produced with .Dl "jot -r -c 160 a z | rs -g 0 8" .Pp Infinitely many .Em yes Ns 's may be obtained through .Dl jot -b yes 0 .Pp and thirty .Xr ed 1 substitution commands applying to lines 2, 7, 12, etc.\& is the result of .Dl jot -w %ds/old/new/ 30 2 - 5 .Pp The stuttering sequence 9, 9, 8, 8, 7, etc.\& can be produced by truncating the output precision and a suitable choice of step size, as in .Dl jot -w %d - 9.5 0 -.5 .Pp and a file containing exactly 1024 bytes is created with .Dl jot -b x 512 > block .Pp Finally, to set tabs four spaces apart starting from column 10 and ending in column 132, use .Dl expand -`jot -s, - 10 132 4` .Pp and to print all lines 80 characters or longer, .Dl grep `jot -s \&"\&" -b \&. 80` .Sh DIAGNOSTICS The following diagnostic messages deserve special explanation: .Bl -diag .It "illegal or unsupported format '%s'" The requested conversion format specifier for .Xr printf 3 was not of the form .Dl %[#][ ][{+,-}][0-9]*[.[0-9]*]? where .Dq ?\& must be one of .Dl [l]{d,i,o,u,x} or .Dl {c,e,f,g,D,E,G,O,U,X} .It "range error in conversion" A value to be printed fell outside the range of the data type associated with the requested output format. .It "too many conversions" More than one conversion format specifier has been supplied, but only one is allowed. .El .Sh SEE ALSO .Xr ed 1 , .Xr expand 1 , .Xr rs 1 , .Xr seq 1 , .Xr yes 1 , .Xr arc4random 3 , .Xr printf 3 , .Xr random 3 .Sh HISTORY The .Nm utility first appeared in .Bx 4.2 . +.Sh AUTHORS +.An John A. Kunze Index: head/usr.bin/lam/lam.1 =================================================================== --- head/usr.bin/lam/lam.1 (revision 281208) +++ head/usr.bin/lam/lam.1 (revision 281209) @@ -1,142 +1,144 @@ .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)lam.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd August 12, 2004 +.Dd April 7, 2015 .Dt LAM 1 .Os .Sh NAME .Nm lam .Nd laminate files .Sh SYNOPSIS .Nm .Op Fl f Ar min . Ns Ar max .Op Fl s Ar sepstring .Op Fl t Ar c .Ar .Nm .Op Fl p Ar min . Ns Ar max .Op Fl s Ar sepstring .Op Fl t Ar c .Ar .Sh DESCRIPTION The .Nm utility copies the named files side by side onto the standard output. The .Em n-th input lines from the input .Ar files are considered fragments of the single long .Em n-th output line into which they are assembled. The name `\fB\-\fP' means the standard input, and may be repeated. .Pp Normally, each option affects only the .Ar file after it. If the option letter is capitalized it affects all subsequent files until it appears again uncapitalized. The options are described below: .Bl -tag -width indent .It Fl f Ar min . Ns Ar max Print line fragments according to the format string .Ar min . Ns Ar max , where .Ar min is the minimum field width and .Ar max the maximum field width. If .Ar min begins with a zero, zeros will be added to make up the field width, and if it begins with a `\-', the fragment will be left-adjusted within the field. .It Fl p Ar min . Ns Ar max Like .Fl f , but pad this file's field when end-of-file is reached and other files are still active. .It Fl s Ar sepstring Print .Ar sepstring before printing line fragments from the next file. This option may appear after the last file. .It Fl t Ar c The input line terminator is .Ar c instead of a newline. The newline normally appended to each output line is omitted. .El .Pp To print files simultaneously for easy viewing use .Xr pr 1 . .Sh EXAMPLES The command .Bd -literal lam file1 file2 file3 file4 .Ed .Pp joins 4 files together along each line. To merge the lines from four different files use .Bd -literal lam file1 \-S "\\ " file2 file3 file4 .Ed .Pp Every 2 lines of a file may be joined on one line with .Bd -literal lam \- \- < file .Ed .Pp and a form letter with substitutions keyed by `@' can be done with .Bd -literal lam \-t @ letter changes .Ed .Sh SEE ALSO .Xr join 1 , .Xr paste 1 , .Xr pr 1 , .Xr printf 3 .Sh STANDARDS Some of the functionality of .Nm is standardized as the .Xr paste 1 utility by .St -p1003.2 . .Sh HISTORY The .Nm utility first appeared in .Bx 4.2 . +.Sh AUTHORS +.An John A. Kunze .Sh BUGS The .Nm utility does not recognize multibyte characters. Index: head/usr.bin/rs/rs.1 =================================================================== --- head/usr.bin/rs/rs.1 (revision 281208) +++ head/usr.bin/rs/rs.1 (revision 281209) @@ -1,245 +1,247 @@ .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)rs.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd February 25, 2011 +.Dd April 7, 2015 .Dt RS 1 .Os .Sh NAME .Nm rs .Nd reshape a data array .Sh SYNOPSIS .Nm .Oo .Fl Oo Cm csCS Oc Ns Op Ar x .Oo Cm kKgGw Oc Ns Op Ar N .Cm tTeEnyjhHmz .Oc .Op Ar rows Op Ar cols .Sh DESCRIPTION The .Nm utility reads the standard input, interpreting each line as a row of blank-separated entries in an array, transforms the array according to the options, and writes it on the standard output. With no arguments it transforms stream input into a columnar format convenient for terminal viewing. .Pp The shape of the input array is deduced from the number of lines and the number of columns on the first line. If that shape is inconvenient, a more useful one might be obtained by skipping some of the input with the .Fl k option. Other options control interpretation of the input columns. .Pp The shape of the output array is influenced by the .Ar rows and .Ar cols specifications, which should be positive integers. If only one of them is a positive integer, .Nm computes a value for the other which will accommodate all of the data. When necessary, missing data are supplied in a manner specified by the options and surplus data are deleted. There are options to control presentation of the output columns, including transposition of the rows and columns. .Pp The following options are available: .Bl -tag -width indent .It Fl c Ns Ar x Input columns are delimited by the single character .Ar x . A missing .Ar x is taken to be `^I'. .It Fl s Ns Ar x Like .Fl c , but maximal strings of .Ar x are delimiters. .It Fl C Ns Ar x Output columns are delimited by the single character .Ar x . A missing .Ar x is taken to be `^I'. .It Fl S Ns Ar x Like .Fl C , but padded strings of .Ar x are delimiters. .It Fl t Fill in the rows of the output array using the columns of the input array, that is, transpose the input while honoring any .Ar rows and .Ar cols specifications. .It Fl T Print the pure transpose of the input, ignoring any .Ar rows or .Ar cols specification. .It Fl k Ns Ar N Ignore the first .Ar N lines of input. .It Fl K Ns Ar N Like .Fl k , but print the ignored lines. .It Fl g Ns Ar N The gutter width (inter-column space), normally 2, is taken to be .Ar N . .It Fl G Ns Ar N The gutter width has .Ar N percent of the maximum column width added to it. .It Fl e Consider each line of input as an array entry. .It Fl n On lines having fewer entries than the first line, use null entries to pad out the line. Normally, missing entries are taken from the next line of input. .It Fl y If there are too few entries to make up the output dimensions, pad the output by recycling the input from the beginning. Normally, the output is padded with blanks. .It Fl h Print the shape of the input array and do nothing else. The shape is just the number of lines and the number of entries on the first line. .It Fl H Like .Fl h , but also print the length of each line. .It Fl j Right adjust entries within columns. .It Fl w Ns Ar N The width of the display, normally 80, is taken to be the positive integer .Ar N . .It Fl m Do not trim excess delimiters from the ends of the output array. .It Fl z Adapt column widths to fit the largest entries appearing in them. .El .Pp With no arguments, .Nm transposes its input, and assumes one array entry per input line unless the first non-ignored line is longer than the display width. Option letters which take numerical arguments interpret a missing number as zero unless otherwise indicated. .Sh EXAMPLES The .Nm utility can be used as a filter to convert the stream output of certain programs (e.g., .Xr spell 1 , .Xr du 1 , .Xr file 1 , .Xr look 1 , .Xr nm 1 , .Xr who 1 , and .Xr wc 1 ) into a convenient ``window'' format, as in .Bd -literal -offset indent % who | rs .Ed .Pp This function has been incorporated into the .Xr ls 1 program, though for most programs with similar output .Nm suffices. .Pp To convert stream input into vector output and back again, use .Bd -literal -offset indent % rs 1 0 | rs 0 1 .Ed .Pp A 10 by 10 array of random numbers from 1 to 100 and its transpose can be generated with .Bd -literal -offset indent % jot \-r 100 | rs 10 10 | tee array | rs \-T > tarray .Ed .Pp In the editor .Xr vi 1 , a file consisting of a multi-line vector with 9 elements per line can undergo insertions and deletions, and then be neatly reshaped into 9 columns with .Bd -literal -offset indent :1,$!rs 0 9 .Ed .Pp Finally, to sort a database by the first line of each 4-line field, try .Bd -literal -offset indent % rs \-eC 0 4 | sort | rs \-c 0 1 .Ed .Sh SEE ALSO .Xr jot 1 , .Xr pr 1 , .Xr sort 1 , .Xr vi 1 .Sh HISTORY The .Nm utility first appeared in .Bx 4.2 . +.Sh AUTHORS +.An John A. Kunze .Sh BUGS .Bl -item .It Handles only two dimensional arrays. .It The algorithm currently reads the whole file into memory, so files that do not fit in memory will not be reshaped. .It Fields cannot be defined yet on character positions. .It Re-ordering of columns is not yet possible. .It There are too many options. .It Multibyte characters are not recognized. .It Lines longer than .Dv LINE_MAX (2048) bytes are not processed and result in immediate termination of .Nm . .El