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