xref: /minix3/usr.bin/jot/jot.1 (revision 075dbe55f35c411d440c66d581a9e79eed791d2f)
1.\"	$NetBSD: jot.1,v 1.12 2012/04/08 22:00:39 wiz 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.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.
107While at least one of them must appear,
108any of the other three 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
124Defaults for the four arguments are, respectively,
125100, 1, 100, and 1, except that when random data are requested,
126.Ar s
127defaults to a seed depending upon the time of day.
128.Ar reps
129is expected to be an unsigned integer,
130and if given as zero is taken to be infinite.
131.Ar begin
132and
133.Ar end
134may be given as real numbers or as characters
135representing the corresponding value in ASCII.
136The last argument must be a real number.
137.Pp
138Random numbers are obtained through
139.Xr random 3 .
140The name
141.Nm jot
142derives in part from
143.Nm iota ,
144a function in APL.
145.Sh EXAMPLES
146The command:
147.Dl "jot - 42 87 1"
148prints the integers from 42 to 87, inclusive.
149.Pp
150The command:
151.Dl "jot 21 \-1 1.00"
152prints 21 evenly spaced numbers increasing from \-1 to 1.
153.Pp
154The command:
155.Dl "jot \-c 128 0"
156prints the ASCII character set.
157.Pp
158The command:
159.Dl "jot \-w xa%c 26 a"
160prints the strings
161.Dq xaa
162through
163.Dq xaz .
164.Pp
165The command:
166.Dl "jot \-r \-c 160 a z | rs \-g 0 8"
167prints 20 random 8-letter strings.
168.Pp
169The command:
170.Dl "jot \-b y 0"
171is equivalent to
172.Xr yes 1 .
173.Pp
174The command:
175.Dl "jot \-w %ds/old/new/ 30 2 \- 5"
176prints thirty
177.Xr ed 1
178substitution commands applying to lines 2, 7, 12, etc.
179.Pp
180The command:
181.Dl "jot 0 9 \- \-.5"
182prints the stuttering sequence 9, 8, 8, 7, etc.
183.Pp
184The command:
185.Dl "jot \-b x 512 \*[Gt] block"
186creates a file containing exactly 1024 bytes.
187.Pp
188The command:
189.Dl "expand \-\`jot \-s, \- 10 132 4\`"
190sets tabs four spaces apart starting
191from column 10 and ending in column 132.
192.Pp
193The command:
194.Dl "grep \`jot \-s """" \-b . 80\`"
195prints all lines 80 characters or longer.
196.Sh SEE ALSO
197.Xr ed 1 ,
198.Xr expand 1 ,
199.Xr rs 1 ,
200.Xr seq 1 ,
201.Xr yes 1 ,
202.Xr printf 3 ,
203.Xr random 3
204