xref: /dragonfly/usr.bin/jot/jot.1 (revision dc71b7ab)
1.\" Copyright (c) 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"	@(#)jot.1	8.1 (Berkeley) 6/6/93
29.\" $FreeBSD: src/usr.bin/jot/jot.1,v 1.8.2.6 2002/07/15 07:13:13 keramida Exp $
30.\" $DragonFly: src/usr.bin/jot/jot.1,v 1.2 2003/06/17 04:29:27 dillon Exp $
31.\"
32.Dd June 6, 1993
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 w Ar word
43.Op Fl s Ar string
44.Op Fl p Ar precision
45.Op Ar reps Op Ar begin Op Ar end Op Ar s
46.Sh DESCRIPTION
47The
48.Nm
49utility is used to print out increasing, decreasing, random,
50or redundant data, usually numbers, one per line.
51.Pp
52The following options are available:
53.Bl -tag -width indent
54.It Fl r
55Generate random data instead of the default sequential data.
56.It Fl b Ar word
57Just print
58.Ar word
59repetitively.
60.It Fl w Ar word
61Print
62.Ar word
63with the generated data appended to it.
64Octal, hexadecimal, exponential,
65.Tn ASCII ,
66zero padded,
67and right-adjusted representations
68are possible by using the appropriate
69.Xr printf 3
70conversion specification inside
71.Ar word ,
72in which case the data are inserted rather than appended.
73.It Fl c
74This is an abbreviation for
75.Fl w Ar %c .
76.It Fl s Ar string
77Print data separated by
78.Ar string .
79Normally, newlines separate data.
80.It Fl n
81Do not print the final newline normally appended to the output.
82.It Fl p Ar precision
83Print only as many digits or characters of the data
84as indicated by the integer
85.Ar precision .
86In the absence of
87.Fl p ,
88the precision is the greater of the precisions of
89.Ar begin
90and
91.Ar end .
92The
93.Fl p
94option is overridden by whatever appears in a
95.Xr printf 3
96conversion following
97.Fl w .
98.El
99.Pp
100The last four arguments indicate, respectively,
101the number of data, the lower bound, the upper bound,
102and the step size or, for random data, the seed.
103While at least one of them must appear,
104any of the other three may be omitted, and
105will be considered as such if given as
106.Fl "" .
107Any three of these arguments determines the fourth.
108If four are specified and the given and computed values of
109.Ar reps
110conflict, the lower value is used.
111If fewer than three are specified, defaults are assigned
112left to right, except for
113.Ar s ,
114which assumes its default unless both
115.Ar begin
116and
117.Ar end
118are given.
119.Pp
120Defaults for the four arguments are, respectively,
121100, 1, 100, and 1, except that when random data are requested,
122the seed,
123.Ar s ,
124is picked randomly.
125The
126.Ar reps
127argument is expected to be an unsigned integer,
128and if given as zero is taken to be infinite.
129The
130.Ar begin
131and
132.Ar end
133arguments may be given as real numbers or as characters
134representing the corresponding value in
135.Tn ASCII .
136The last argument must be a real number.
137.Pp
138Random numbers are obtained through
139.Xr random 3 .
140The name
141.Nm
142derives in part from
143.Nm iota ,
144a function in APL.
145.Sh EXIT STATUS
146.Ex -std
147.Sh EXAMPLES
148The command
149.Dl jot 21 -1 1.00
150.Pp
151prints 21 evenly spaced numbers increasing from -1 to 1.
152The
153.Tn ASCII
154character set is generated with
155.Dl jot -c 128 0
156.Pp
157and the strings xaa through xaz with
158.Dl jot -w xa%c 26 a
159.Pp
160while 20 random 8-letter strings are produced with
161.Dl "jot -r -c 160 a z | rs -g 0 8"
162.Pp
163Infinitely many
164.Em yes Ns 's
165may be obtained through
166.Dl jot -b yes 0
167.Pp
168and thirty
169.Xr ed 1
170substitution commands applying to lines 2, 7, 12, etc. is
171the result of
172.Dl jot -w %ds/old/new/ 30 2 - 5
173.Pp
174The stuttering sequence 9, 9, 8, 8, 7, etc. can be
175produced by suitable choice of step size,
176as in
177.Dl jot - 9 0 -.5
178.Pp
179and a file containing exactly 1024 bytes is created with
180.Dl jot -b x 512 > block
181.Pp
182Finally, to set tabs four spaces apart starting
183from column 10 and ending in column 132, use
184.Dl expand -`jot -s, - 10 132 4`
185.Pp
186and to print all lines 80 characters or longer,
187.Dl grep `jot -s \&"\&" -b \&. 80`
188.Sh DIAGNOSTICS
189The following diagnostic messages deserve special explanation:
190.Bl -diag
191.It "illegal or unsupported format '%s'"
192The requested conversion format specifier for
193.Xr printf 3
194was not of the form
195.Dl %[#][ ][{+,-}][0-9]*[.[0-9]*]?
196where
197.Dq ?\&
198must be one of
199.Dl [l]{d,i,o,u,x}
200or
201.Dl {c,e,f,g,D,E,G,O,U,X}
202.It "range error in conversion"
203A value to be printed fell outside the range of the data type
204associated with the requested output format.
205.It "too many conversions"
206More than one conversion format specifier has been supplied,
207but only one is allowed.
208.El
209.Sh SEE ALSO
210.Xr ed 1 ,
211.Xr expand 1 ,
212.Xr rs 1 ,
213.Xr yes 1 ,
214.Xr printf 3 ,
215.Xr random 3
216