xref: /netbsd-src/usr.bin/jot/jot.1 (revision 48c051401bf22a25531f843e256d663b4ec23661)
1.\"	$NetBSD: jot.1,v 1.17 2020/04/25 11:11:33 simonb 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 April 25, 2020
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.
57The default is to produce sequential data.
58.Pp
59The following options are available:
60.Bl -tag -width indent
61.It Fl b Ar word
62Just print
63.Ar word
64repetitively.
65.It Fl c
66This is an abbreviation for
67.Fl w Ar %c .
68.It Fl n
69Do not print the final newline normally appended to the output.
70.It Fl p Ar precision
71Print only as many digits or characters of the data
72as indicated by the integer
73.Ar precision .
74In the absence of
75.Fl p ,
76the precision is the greater of the precisions of
77.Ar begin
78and
79.Ar end .
80The
81.Fl p
82option is overridden by whatever appears in a
83.Xr printf 3
84conversion following
85.Fl w .
86.It Fl r
87Generate random data.
88.It Fl s Ar string
89Print data separated by
90.Ar string .
91Normally, newlines separate data.
92.It Fl w Ar word
93Print
94.Ar word
95with the generated data appended to it.
96Octal, hexadecimal, exponential, ASCII, zero padded,
97and right-adjusted representations
98are possible by using the appropriate
99.Xr printf 3
100conversion specification inside
101.Ar word ,
102in which case the data are inserted rather than appended.
103.El
104.Pp
105The last four arguments indicate, respectively,
106the number of data, the lower bound, the upper bound,
107and the step size or, for random data, the seed.
108Any argument may be omitted, and
109will be considered as such if given as
110.Dq - .
111Any three of these arguments determines the fourth.
112If four are specified and the given and computed values of
113.Ar reps
114conflict, the lower value is used.
115If fewer than three are specified, defaults are assigned
116left to right, except for
117.Ar s ,
118which assumes its default unless both
119.Ar begin
120and
121.Ar end
122are given.
123.Pp
124When sequential data are requested the defaults for the four arguments
125are 100 data, a lower bound of 1, an upper bound of 100 and a step size
126of 1.
127When random data are requested
128.Ar s
129defaults to a seed depending upon the time of day.
130.Ar reps
131is expected to be an unsigned integer,
132and if given as zero is taken to be infinite.
133.Ar begin
134and
135.Ar end
136may be given as real numbers or as characters
137representing the corresponding value in ASCII.
138The last argument must be a real number.
139.Pp
140Random numbers are obtained through
141.Xr random 3 .
142The name
143.Nm jot
144derives in part from
145.Nm iota ,
146a function in APL.
147.Sh EXAMPLES
148The command:
149.Dl "jot - 42 87 1"
150prints the integers from 42 to 87, inclusive.
151.Pp
152The command:
153.Dl "jot 21 \-1 1.00"
154prints 21 evenly spaced numbers increasing from \-1 to 1.
155.Pp
156The command:
157.Dl "jot \-c 128 0"
158prints the ASCII character set.
159.Pp
160The command:
161.Dl "jot \-w xa%c 26 a"
162prints the strings
163.Dq xaa
164through
165.Dq xaz .
166.Pp
167The command:
168.Dl "jot \-r \-c 160 a z | rs \-g 0 8"
169prints 20 random 8-letter strings.
170.Pp
171The command:
172.Dl "jot \-b y 0"
173is equivalent to
174.Xr yes 1 .
175.Pp
176The command:
177.Dl "jot \-w %ds/old/new/ 30 2 \- 5"
178prints thirty
179.Xr ed 1
180substitution commands applying to lines 2, 7, 12, etc.
181.Pp
182The command:
183.Dl "jot 0 9 \- \-.5"
184prints the stuttering sequence 9, 8, 8, 7, etc.
185.Pp
186The command:
187.Dl "jot \-b x 512 > block"
188creates a file containing exactly 1024 bytes.
189.Pp
190The command:
191.Dl "expand \-\`jot \-s, \- 10 132 4\`"
192sets tabs four spaces apart starting
193from column 10 and ending in column 132.
194.Pp
195The command:
196.Dl "grep \`jot \-s """" \-b . 80\`"
197prints all lines 80 characters or longer.
198.Sh SEE ALSO
199.Xr ed 1 ,
200.Xr expand 1 ,
201.Xr rs 1 ,
202.Xr seq 1 ,
203.Xr yes 1 ,
204.Xr printf 3 ,
205.Xr random 3
206.Sh HISTORY
207The
208.Nm
209utility first appeared in
210.Bx 4.2 .
211.Sh AUTHORS
212.An John A. Kunze
213