xref: /dragonfly/usr.bin/jot/jot.1 (revision 984263bc)
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.\"
35.Dd June 6, 1993
36.Dt JOT 1
37.Os
38.Sh NAME
39.Nm jot
40.Nd print sequential or random data
41.Sh SYNOPSIS
42.Nm
43.Op Fl cnr
44.Op Fl b Ar word
45.Op Fl w Ar word
46.Op Fl s Ar string
47.Op Fl p Ar precision
48.Op Ar reps Op Ar begin Op Ar end Op Ar s
49.Sh DESCRIPTION
50The
51.Nm
52utility is used to print out increasing, decreasing, random,
53or redundant data, usually numbers, one per line.
54.Pp
55The following options are available:
56.Bl -tag -width indent
57.It Fl r
58Generate random data instead of the default sequential data.
59.It Fl b Ar word
60Just print
61.Ar word
62repetitively.
63.It Fl w Ar word
64Print
65.Ar word
66with the generated data appended to it.
67Octal, hexadecimal, exponential,
68.Tn ASCII ,
69zero padded,
70and right-adjusted representations
71are possible by using the appropriate
72.Xr printf 3
73conversion specification inside
74.Ar word ,
75in which case the data are inserted rather than appended.
76.It Fl c
77This is an abbreviation for
78.Fl w Ar %c .
79.It Fl s Ar string
80Print data separated by
81.Ar string .
82Normally, newlines separate data.
83.It Fl n
84Do not print the final newline normally appended to the output.
85.It Fl p Ar precision
86Print only as many digits or characters of the data
87as indicated by the integer
88.Ar precision .
89In the absence of
90.Fl p ,
91the precision is the greater of the precisions of
92.Ar begin
93and
94.Ar end .
95The
96.Fl p
97option is overridden by whatever appears in a
98.Xr printf 3
99conversion following
100.Fl w .
101.El
102.Pp
103The last four arguments indicate, respectively,
104the number of data, the lower bound, the upper bound,
105and the step size or, for random data, the seed.
106While at least one of them must appear,
107any of the other three may be omitted, and
108will be considered as such if given as
109.Fl "" .
110Any three of these arguments determines the fourth.
111If four are specified and the given and computed values of
112.Ar reps
113conflict, the lower value is used.
114If fewer than three are specified, defaults are assigned
115left to right, except for
116.Ar s ,
117which assumes its default unless both
118.Ar begin
119and
120.Ar end
121are given.
122.Pp
123Defaults for the four arguments are, respectively,
124100, 1, 100, and 1, except that when random data are requested,
125the seed,
126.Ar s ,
127is picked randomly.
128The
129.Ar reps
130argument is expected to be an unsigned integer,
131and if given as zero is taken to be infinite.
132The
133.Ar begin
134and
135.Ar end
136arguments may be given as real numbers or as characters
137representing the corresponding value in
138.Tn ASCII .
139The last argument must be a real number.
140.Pp
141Random numbers are obtained through
142.Xr random 3 .
143The name
144.Nm
145derives in part from
146.Nm iota ,
147a function in APL.
148.Sh EXAMPLES
149The command
150.Dl jot 21 -1 1.00
151.Pp
152prints 21 evenly spaced numbers increasing from -1 to 1.
153The
154.Tn ASCII
155character set is generated with
156.Dl jot -c 128 0
157.Pp
158and the strings xaa through xaz with
159.Dl jot -w xa%c 26 a
160.Pp
161while 20 random 8-letter strings are produced with
162.Dl "jot -r -c 160 a z | rs -g 0 8"
163.Pp
164Infinitely many
165.Em yes Ns 's
166may be obtained through
167.Dl jot -b yes 0
168.Pp
169and thirty
170.Xr ed 1
171substitution commands applying to lines 2, 7, 12, etc. is
172the result of
173.Dl jot -w %ds/old/new/ 30 2 - 5
174.Pp
175The stuttering sequence 9, 9, 8, 8, 7, etc. can be
176produced by suitable choice of step size,
177as in
178.Dl jot - 9 0 -.5
179.Pp
180and a file containing exactly 1024 bytes is created with
181.Dl jot -b x 512 > block
182.Pp
183Finally, to set tabs four spaces apart starting
184from column 10 and ending in column 132, use
185.Dl expand -`jot -s, - 10 132 4`
186.Pp
187and to print all lines 80 characters or longer,
188.Dl grep `jot -s \&"\&" -b \&. 80`
189.Sh DIAGNOSTICS
190.Ex -std
191The following diagnostic messages deserve special explanation:
192.Bl -diag
193.It "illegal or unsupported format '%s'"
194The requested conversion format specifier for
195.Xr printf 3
196was not of the form
197.Dl %[#][ ][{+,-}][0-9]*[.[0-9]*]?
198where
199.Dq ?\&
200must be one of
201.Dl [l]{d,i,o,u,x}
202or
203.Dl {c,e,f,g,D,E,G,O,U,X}
204.It "range error in conversion"
205A value to be printed fell outside the range of the data type
206associated with the requested output format.
207.It "too many conversions"
208More than one conversion format specifier has been supplied,
209but only one is allowed.
210.El
211.Sh SEE ALSO
212.Xr ed 1 ,
213.Xr expand 1 ,
214.Xr rs 1 ,
215.Xr yes 1 ,
216.Xr printf 3 ,
217.Xr random 3
218