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