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