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