Name

jot - print sequential or random data.

Synopsis

jot [-cnr] [-b word] [-w word] [-s separator] [-p precision] [count [begin [end [s]]]]

Description

Jot prints out increasing, decreasing, or random data, one item per line.

The four arguments count, begin, end, and s are the number of items to print, the starting point, the ending point, and the step size. While at least one of them must appear, any of the other three may be omitted (giving - counts) and will be given default values. The defaults for these arguments are count=100, begin=1, end=100, and s=1. count is expected to be an unsigned integer, and if given as zero is taken to be infinite. begin and end may be given as real numbers or as characters representing the corresponding value in ASCII.

Jot takes the following options:

=-r= Generate random data instead of sequential data. If -r is given, the fourth argument is not used as a step size, but as a seed for the random number generator, and it defaults to a random seed.

=-bword= Just print word repetitively.

=-wword= Print word with the generated data appended to it. If the word contains a printf(3) conversion specification, the data is instead printed using that format.

=-c= This is an abbreviation for -wc.

=-sseparator= Use separator between data elements instead of a newline.

=-n= Do not print the final newline normally appended to the output.

=-pprecision= Print only as many digits or characters of the data as indicated by the integer precision. In the absence of -p, the precision is the greated or the precisions of begin and end. The -p option is overwritten by whatever appears in a -w argument.

Examples

  1. The command jot -b y 0 prints “y” forever.

  2. The ascii character set is generated with jot -c 128 0

  3. The strings xaa through xaz with jot -w xa%c 26 a

  4. The stuttering sequence 9, 9, 8, 8, 7, etc. can be produced by suitable choice of stepsize, as in jot - 9 0 -.5 (the exact output depends on the vagaries of rounding; on the FreeBSD machine I wrote this code on, this command produces 9, 8, 8, 7 ... 1, 1, 0 instead of the traditional jot behavior.)

Diagnostics

Jot returns with failure status if an error occurs. Most diagnostics are self-explanatory, but a few need extra explanations:

=illegal or unsupported format ‘%s’= The requested conversion format for -w was not appropriate. It needs to be of the form %[#] [ ] [{+,-}][0-9][.[0-9]]? where ? must be one of [l]{d,i,io,u,x} or {c,e,f,g,D,E,G,O,U,X}

=impossible stepsize= begin is larger than end but the step size is less than zero, or visa versa.

=Too many conversions= Only one conversion format is allowed in -w.

Authors

Jessica L. Parsons orc@pell.portland.or.us
The random number generator originally appeared in Toward a Universal Random Number Generator by George Marsaglia and Arif Zaman. Florida State University Report: FSU-SCRI-87-50 (1987)

Mastodon