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. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)jot.1 8.1 (Berkeley) 6/6/93
31 .Dd September 21, 2019
36 .Nd print sequential or random data
44 .Op Ar reps Op Ar begin Op Ar end Op Ar s
48 utility is used to print out increasing, decreasing, random,
49 or redundant data, usually numbers, one per line.
51 The following options are available:
52 .Bl -tag -width indent
54 Generate random data instead of the default sequential data.
62 with the generated data appended to it.
63 Octal, hexadecimal, exponential,
66 and right-adjusted representations
67 are possible by using the appropriate
69 conversion specification inside
71 in which case the data are inserted rather than appended.
73 This is an abbreviation for
76 Print data separated by
78 Normally, newlines separate data.
80 Do not print the final newline normally appended to the output.
82 Print only as many digits or characters of the data
83 as indicated by the integer
87 the precision is the greater of the precisions of
93 option is overridden by whatever appears in a
99 The last four arguments indicate, respectively,
100 the number of data, the lower bound, the upper bound,
101 and the step size or, for random data, the seed.
102 While at least one of them must appear,
103 any of the other three may be omitted, and
104 will be considered as such if given as
106 or as an empty string.
107 Any three of these arguments determines the fourth.
108 If four are specified and the given and computed values of
110 conflict, the lower value is used.
111 If one or two are specified, defaults are assigned
114 which assumes a default of 1 (or -1 if
118 specify a descending range).
119 Then the default values are assigned to the leftmost omitted arguments until
120 three arguments are set.
122 Defaults for the four arguments are, respectively,
123 100, 1, 100, and 1, except that when random data are requested,
129 argument is expected to be an unsigned integer,
130 and if given as zero is taken to be infinite.
135 arguments may be given as real numbers or as characters
136 representing the corresponding value in
138 The last argument must be a real number.
140 Random numbers are obtained through
142 when no seed is specified,
145 when a seed is given.
148 is asked to generate random integers or characters with begin
149 and end values in the range of the random number generator function
150 and no format is specified with one of the
157 will arrange for all the values in the range to appear in the output
158 with an equal probability.
159 In all other cases be careful to ensure that the output format's
160 rounding or truncation will not skew the distribution of output
161 values in an unintended way.
168 .Ss Rounding and truncation
171 utility uses double precision floating point arithmetic internally.
172 Before printing a number, it is converted depending on the output
175 If no output format is specified or the output format is a
176 floating point format
185 the value is rounded using the
187 function, taking into account the requested precision.
189 If the output format is an integer format
203 the value is converted to an integer value by truncation.
205 As an illustration, consider the following command:
206 .Bd -literal -offset indent
216 By requesting an explicit precision of 1, the values generated before rounding
218 The .5 values are rounded down if the integer part is even,
220 .Bd -literal -offset indent
221 $ jot -p 1 6 1 10 0.5
230 By offsetting the values slightly, the values generated by the following
231 command are always rounded down:
232 .Bd -literal -offset indent
233 $ jot -p 0 6 .9999999999 10 0.5
242 Another way of achieving the same result is to force truncation by
243 specifying an integer format:
244 .Bd -literal -offset indent
245 $ jot -w %d 6 1 10 0.5
253 prints the integers from 1 to 10,
257 prints 21 evenly spaced numbers increasing from -1 to 1.
260 character set is generated with
263 and the strings xaa through xaz with
266 while 20 random 8-letter strings are produced with
267 .Dl "jot -r -c 160 a z | rs -g 0 8"
271 may be obtained through
276 substitution commands applying to lines 2, 7, 12, etc.\& is
278 .Dl jot -w %ds/old/new/ 30 2 - 5
280 The stuttering sequence 9, 9, 8, 8, 7, etc.\& can be
281 produced by truncating the output precision and a suitable choice of step size,
283 .Dl jot -w %d - 9.5 0 -.5
285 and a file containing exactly 1024 bytes is created with
286 .Dl jot -b x 512 > block
288 Finally, to set tabs four spaces apart starting
289 from column 10 and ending in column 132, use
290 .Dl expand -`jot -s, - 10 132 4`
292 and to print all lines 80 characters or longer,
293 .Dl grep `jot -s \&"\&" -b \&. 80`
295 The following diagnostic messages deserve special explanation:
297 .It "illegal or unsupported format '%s'"
298 The requested conversion format specifier for
301 .Dl %[#][ ][{+,-}][0-9]*[.[0-9]*]?
307 .Dl {c,e,f,g,D,E,G,O,U,X}
308 .It "range error in conversion"
309 A value to be printed fell outside the range of the data type
310 associated with the requested output format.
311 .It "too many conversions"
312 More than one conversion format specifier has been supplied,
313 but only one is allowed.
327 utility first appeared in