xref: /netbsd-src/usr.bin/jot/jot.1 (revision 179b12252ecaf3553d9c2b7458ce62b6a2203d0c)
1.\"	$NetBSD: jot.1,v 1.10 2009/03/11 13:53:51 joerg 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 February 24, 2008
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 21 \-1 1.00"
156prints 21 evenly spaced numbers increasing from \-1 to 1.
157.Pp
158The command:
159.Dl "jot \-c 128 0"
160prints the ASCII character set.
161.Pp
162The command:
163.Dl "jot \-w xa%c 26 a"
164prints the strings
165.Dq xaa
166through
167.Dq xaz .
168.Pp
169The command:
170.Dl "jot \-r \-c 160 a z | rs \-g 0 8"
171prints 20 random 8-letter strings.
172.Pp
173The command:
174.Dl "jot \-b y 0"
175is equivalent to
176.Xr yes 1 .
177.Pp
178The command:
179.Dl "jot \-w %ds/old/new/ 30 2 \- 5"
180prints thirty
181.Xr ed 1
182substitution commands applying to lines 2, 7, 12, etc.
183.Pp
184The command:
185.Dl "jot 0 9 \- \-.5"
186prints the stuttering sequence 9, 8, 8, 7, etc.
187.Pp
188The command:
189.Dl "jot \-b x 512 \*[Gt] block"
190creates a file containing exactly 1024 bytes.
191.Pp
192The command:
193.Dl "expand \-\`jot \-s, \- 10 132 4\`"
194sets tabs four spaces apart starting
195from column 10 and ending in column 132.
196.Pp
197The command:
198.Dl "grep \`jot \-s """" \-b . 80\`"
199prints all lines 80 characters or longer.
200.Sh SEE ALSO
201.Xr ed 1 ,
202.Xr expand 1 ,
203.Xr rs 1 ,
204.Xr yes 1 ,
205.Xr printf 3 ,
206.Xr random 3
207