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