2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)jot.1 8.1 (Berkeley) 6/6/93
40 .Nd print sequential or random data
48 .Op Ar reps Op Ar begin Op Ar end Op Ar s
52 utility is used to print out increasing, decreasing, random,
53 or redundant data, usually numbers, one per line.
55 The following options are available:
56 .Bl -tag -width indent
58 Generate random data instead of the default sequential data.
66 with the generated data appended to it.
67 Octal, hexadecimal, exponential,
70 and right-adjusted representations
71 are possible by using the appropriate
73 conversion specification inside
75 in which case the data are inserted rather than appended.
77 This is an abbreviation for
80 Print data separated by
82 Normally, newlines separate data.
84 Do not print the final newline normally appended to the output.
86 Print only as many digits or characters of the data
87 as indicated by the integer
91 the precision is the greater of the precisions of
97 option is overridden by whatever appears in a
103 The last four arguments indicate, respectively,
104 the number of data, the lower bound, the upper bound,
105 and the step size or, for random data, the seed.
106 While at least one of them must appear,
107 any of the other three may be omitted, and
108 will be considered as such if given as
110 or as an empty string.
111 Any three of these arguments determines the fourth.
112 If four are specified and the given and computed values of
114 conflict, the lower value is used.
115 If fewer than three are specified, defaults are assigned
116 left to right, except for
118 which assumes a default of 1 or -1 if both
124 Defaults for the four arguments are, respectively,
125 100, 1, 100, and 1, except that when random data are requested,
131 argument is expected to be an unsigned integer,
132 and if given as zero is taken to be infinite.
137 arguments may be given as real numbers or as characters
138 representing the corresponding value in
140 The last argument must be a real number.
142 Random numbers are obtained through
144 when no seed is specified,
147 when a seed is given.
150 is asked to generate random integers or characters with begin
151 and end values in the range of the random number generator function
152 and no format is specified with one of the
159 will arrange for all the values in the range to appear in the output
160 with an equal probability.
161 In all other cases be careful to ensure that the output format's
162 rounding or truncation will not skew the distribution of output
163 values in an unintended way.
170 .Ss Rounding and truncation
173 utility uses double precision floating point arithmetic internally.
174 Before printing a number, it is converted depending on the output
177 If no output format is specified or the output format is a
178 floating point format
187 the value is rounded using the
189 function, taking into account the requested precision.
191 If the output format is an integer format
205 the value is converted to an integer value by truncation.
207 As an illustration, consider the following command:
208 .Bd -literal -offset indent
218 By requesting an explicit precision of 1, the values generated before rounding
220 The .5 values are rounded down if the integer part is even,
222 .Bd -literal -offset indent
223 $ jot -p 1 6 1 10 0.5
232 By offsetting the values slightly, the values generated by the following
233 command are always rounded down:
234 .Bd -literal -offset indent
235 $ jot -p 0 6 .9999999999 10 0.5
244 Another way of achieving the same result is to force truncation by
245 specifying an integer format:
246 .Bd -literal -offset indent
247 $ jot -w %d 6 1 10 0.5
256 prints the integers from 1 to 10,
260 prints 21 evenly spaced numbers increasing from -1 to 1.
263 character set is generated with
266 and the strings xaa through xaz with
269 while 20 random 8-letter strings are produced with
270 .Dl "jot -r -c 160 a z | rs -g 0 8"
274 may be obtained through
279 substitution commands applying to lines 2, 7, 12, etc.\& is
281 .Dl jot -w %ds/old/new/ 30 2 - 5
283 The stuttering sequence 9, 9, 8, 8, 7, etc.\& can be
284 produced by truncating the output precision and a suitable choice of step size,
286 .Dl jot -w %d - 9.5 0 -.5
288 and a file containing exactly 1024 bytes is created with
289 .Dl jot -b x 512 > block
291 Finally, to set tabs four spaces apart starting
292 from column 10 and ending in column 132, use
293 .Dl expand -`jot -s, - 10 132 4`
295 and to print all lines 80 characters or longer,
296 .Dl grep `jot -s \&"\&" -b \&. 80`
298 The following diagnostic messages deserve special explanation:
300 .It "illegal or unsupported format '%s'"
301 The requested conversion format specifier for
304 .Dl %[#][ ][{+,-}][0-9]*[.[0-9]*]?
310 .Dl {c,e,f,g,D,E,G,O,U,X}
311 .It "range error in conversion"
312 A value to be printed fell outside the range of the data type
313 associated with the requested output format.
314 .It "too many conversions"
315 More than one conversion format specifier has been supplied,
316 but only one is allowed.
329 utility first appeared in