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