]> git.saurik.com Git - apple/shell_cmds.git/blame - jot/jot.1
shell_cmds-18.tar.gz
[apple/shell_cmds.git] / jot / jot.1
CommitLineData
44bd5ea7
A
1.\" $NetBSD: jot.1,v 1.3 1997/11/01 04:58:39 mycroft Exp $
2.\"
3.\" Copyright (c) 1993
4.\" The Regents of the University of California. All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\" must display the following acknowledgement:
16.\" This product includes software developed by the University of
17.\" California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\" may be used to endorse or promote products derived from this software
20.\" without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\" @(#)jot.1 8.1 (Berkeley) 6/6/93
35.\"
36.Dd November 1, 1997
37.Dt JOT 1
38.Os
39.Sh NAME
40.Nm jot
41.Nd print sequential or random data
42.Sh SYNOPSIS
43.Nm jot
44.Op Fl rcn
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.Oo Ar reps
50.Oo Ar begin
51.Oo Ar end
52.Op Ar s
53.Oc
54.Oc
55.Oc
56.Sh DESCRIPTION
57The
58.Nm jot
59utility is used to print out increasing, decreasing, random,
60or redundant data (usually numbers) one per line.
61.Pp
62The following options are available:
63.Bl -tag -width indent
64.It Fl r
65Generate random data instead of sequential data, the default.
66.It Fl b Ar word
67Just print
68.Ar word
69repetitively.
70.It Fl w Ar word
71Print
72.Ar word
73with the generated data appended to it.
74Octal, hexadecimal, exponential, ASCII, zero padded,
75and right-adjusted representations
76are possible by using the appropriate
77.Xr printf 3
78conversion specification inside
79.Ar word ,
80in which case the data are inserted rather than appended.
81.It Fl c
82This is an abbreviation for \fB\-w %c\fP.
83.It Fl s Ar string
84Print data separated by
85.Ar string .
86Normally, newlines separate data.
87.It Fl n
88Do not print the final newline normally appended to the output.
89.It Fl p Ar precision
90Print only as many digits or characters of the data
91as indicated by the integer
92.Ar precision .
93In the absence of
94.Fl p ,
95the precision is the greater of the precisions of
96.Ar begin
97and
98.Ar end .
99The
100.Fl p
101option is overridden by whatever appears in a
102.Xr printf 3
103conversion following
104.Fl w .
105.El
106.Pp
107The last four arguments indicate, respectively,
108the number of data, the lower bound, the upper bound,
109and the step size or, for random data, the seed.
110While at least one of them must appear,
111any of the other three may be omitted, and
112will be considered as such if given as
113.Dq - .
114Any three of these arguments determines the fourth.
115If four are specified and the given and computed values of
116.Ar reps
117conflict, the lower value is used.
118If fewer than three are specified, defaults are assigned
119left to right, except for
120.Ar s ,
121which assumes its default unless both
122.Ar begin
123and
124.Ar end
125are given.
126.Pp
127Defaults for the four arguments are, respectively,
128100, 1, 100, and 1, except that when random data are requested,
129.Ar s
130defaults to a seed depending upon the time of day.
131.Ar reps
132is expected to be an unsigned integer,
133and if given as zero is taken to be infinite.
134.Ar begin
135and
136.Ar end
137may be given as real numbers or as characters
138representing the corresponding value in ASCII.
139The last argument must be a real number.
140.Pp
141Random numbers are obtained through
142.Xr random 3 .
143The name
144.Nm jot
145derives in part from
146.Nm iota ,
147a function in APL.
148.Sh EXAMPLES
149The command:
150.Dl "jot 21 \-1 1.00"
151prints 21 evenly spaced numbers increasing from \-1 to 1.
152.Pp
153The command:
154.Dl "jot \-c 128 0"
155prints the ASCII character set.
156.Pp
157The command:
158.Dl "jot \-w xa%c 26 a"
159prints the strings
160.Dq xaa
161through
162.Dq xaz .
163.Pp
164The command:
165.Dl "jot \-r \-c 160 a z | rs \-g 0 8"
166prints 20 random 8-letter strings.
167.Pp
168The command:
169.Dl "jot \-b y 0"
170is equivalent to
171.Xr yes 1 .
172.Pp
173The command:
174.Dl "jot \-w %ds/old/new/ 30 2 \- 5"
175prints thirty
176.Xr ed 1
177substitution commands applying to lines 2, 7, 12, etc.
178.Pp
179The command:
180.Dl "jot 0 9 \- \-.5"
181prints the stuttering sequence 9, 9, 8, 8, 7, etc.
182.Pp
183The command:
184.Dl "jot \-b x 512 > block"
185creates a file containing exactly 1024 bytes.
186.Pp
187The command:
188.Dl "expand \-\`jot \-s, \- 10 132 4\`"
189sets tabs four spaces apart starting
190from column 10 and ending in column 132.
191.Pp
192The command:
193.Dl "grep \`jot \-s """" \-b . 80\`"
194prints all lines 80 characters or longer.
195.Sh SEE ALSO
196.Xr ed 1 ,
197.Xr expand 1 ,
198.Xr rs 1 ,
199.Xr yes 1 ,
200.Xr printf 3 ,
201.Xr random 3