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