xref: /netbsd-src/usr.bin/jot/jot.1 (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1.\"	$NetBSD: jot.1,v 1.16 2018/06/25 14:29:17 christos Exp $
2.\"
3.\" Copyright (c) 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)jot.1	8.1 (Berkeley) 6/6/93
31.\"
32.Dd June 25, 2018
33.Dt JOT 1
34.Os
35.Sh NAME
36.Nm jot
37.Nd print sequential or random data
38.Sh SYNOPSIS
39.Nm
40.Op Fl cnr
41.Op Fl b Ar word
42.Op Fl p Ar precision
43.Op Fl s Ar string
44.Op Fl w Ar word
45.Oo Ar reps
46.Oo Ar begin
47.Oo Ar end
48.Op Ar s
49.Oc
50.Oc
51.Oc
52.Sh DESCRIPTION
53The
54.Nm jot
55utility is used to print out increasing, decreasing, random,
56or redundant data (usually numbers) one per line.
57.Pp
58The following options are available:
59.Bl -tag -width indent
60.It Fl b Ar word
61Just print
62.Ar word
63repetitively.
64.It Fl c
65This is an abbreviation for
66.Fl w Ar %c .
67.It Fl n
68Do not print the final newline normally appended to the output.
69.It Fl p Ar precision
70Print only as many digits or characters of the data
71as indicated by the integer
72.Ar precision .
73In the absence of
74.Fl p ,
75the precision is the greater of the precisions of
76.Ar begin
77and
78.Ar end .
79The
80.Fl p
81option is overridden by whatever appears in a
82.Xr printf 3
83conversion following
84.Fl w .
85.It Fl r
86Generate random data instead of sequential data, the default.
87.It Fl s Ar string
88Print data separated by
89.Ar string .
90Normally, newlines separate data.
91.It Fl w Ar word
92Print
93.Ar word
94with the generated data appended to it.
95Octal, hexadecimal, exponential, ASCII, zero padded,
96and right-adjusted representations
97are possible by using the appropriate
98.Xr printf 3
99conversion specification inside
100.Ar word ,
101in which case the data are inserted rather than appended.
102.El
103.Pp
104The last four arguments indicate, respectively,
105the number of data, the lower bound, the upper bound,
106and the step size or, for random data, the seed.
107Any argument may be omitted, and
108will be considered as such if given as
109.Dq - .
110Any three of these arguments determines the fourth.
111If four are specified and the given and computed values of
112.Ar reps
113conflict, the lower value is used.
114If fewer than three are specified, defaults are assigned
115left to right, except for
116.Ar s ,
117which assumes its default unless both
118.Ar begin
119and
120.Ar end
121are given.
122.Pp
123Defaults for the four arguments are, respectively,
124100, 1, 100, and 1, except that when random data are requested,
125.Ar s
126defaults to a seed depending upon the time of day.
127.Ar reps
128is expected to be an unsigned integer,
129and if given as zero is taken to be infinite.
130.Ar begin
131and
132.Ar end
133may be given as real numbers or as characters
134representing the corresponding value in ASCII.
135The last argument must be a real number.
136.Pp
137Random numbers are obtained through
138.Xr random 3 .
139The name
140.Nm jot
141derives in part from
142.Nm iota ,
143a function in APL.
144.Sh EXAMPLES
145The command:
146.Dl "jot - 42 87 1"
147prints the integers from 42 to 87, inclusive.
148.Pp
149The command:
150.Dl "jot 21 \-1 1.00"
151prints 21 evenly spaced numbers increasing from \-1 to 1.
152.Pp
153The command:
154.Dl "jot \-c 128 0"
155prints the ASCII character set.
156.Pp
157The command:
158.Dl "jot \-w xa%c 26 a"
159prints the strings
160.Dq xaa
161through
162.Dq xaz .
163.Pp
164The command:
165.Dl "jot \-r \-c 160 a z | rs \-g 0 8"
166prints 20 random 8-letter strings.
167.Pp
168The command:
169.Dl "jot \-b y 0"
170is equivalent to
171.Xr yes 1 .
172.Pp
173The command:
174.Dl "jot \-w %ds/old/new/ 30 2 \- 5"
175prints thirty
176.Xr ed 1
177substitution commands applying to lines 2, 7, 12, etc.
178.Pp
179The command:
180.Dl "jot 0 9 \- \-.5"
181prints the stuttering sequence 9, 8, 8, 7, etc.
182.Pp
183The command:
184.Dl "jot \-b x 512 > block"
185creates a file containing exactly 1024 bytes.
186.Pp
187The command:
188.Dl "expand \-\`jot \-s, \- 10 132 4\`"
189sets tabs four spaces apart starting
190from column 10 and ending in column 132.
191.Pp
192The command:
193.Dl "grep \`jot \-s """" \-b . 80\`"
194prints all lines 80 characters or longer.
195.Sh SEE ALSO
196.Xr ed 1 ,
197.Xr expand 1 ,
198.Xr rs 1 ,
199.Xr seq 1 ,
200.Xr yes 1 ,
201.Xr printf 3 ,
202.Xr random 3
203.Sh HISTORY
204The
205.Nm
206utility first appeared in
207.Bx 4.2 .
208.Sh AUTHORS
209.An John A. Kunze
210