xref: /netbsd-src/usr.bin/jot/jot.1 (revision 48c051401bf22a25531f843e256d663b4ec23661)
1*48c05140Ssimonb.\"	$NetBSD: jot.1,v 1.17 2020/04/25 11:11:33 simonb Exp $
26e0c4dedSjtc.\"
39636069cSjtc.\" Copyright (c) 1993
49636069cSjtc.\"	The Regents of the University of California.  All rights reserved.
59636069cSjtc.\"
69636069cSjtc.\" Redistribution and use in source and binary forms, with or without
79636069cSjtc.\" modification, are permitted provided that the following conditions
89636069cSjtc.\" are met:
99636069cSjtc.\" 1. Redistributions of source code must retain the above copyright
109636069cSjtc.\"    notice, this list of conditions and the following disclaimer.
119636069cSjtc.\" 2. Redistributions in binary form must reproduce the above copyright
129636069cSjtc.\"    notice, this list of conditions and the following disclaimer in the
139636069cSjtc.\"    documentation and/or other materials provided with the distribution.
1489aaa1bbSagc.\" 3. Neither the name of the University nor the names of its contributors
159636069cSjtc.\"    may be used to endorse or promote products derived from this software
169636069cSjtc.\"    without specific prior written permission.
179636069cSjtc.\"
189636069cSjtc.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
199636069cSjtc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
209636069cSjtc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
219636069cSjtc.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
229636069cSjtc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
239636069cSjtc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
249636069cSjtc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
259636069cSjtc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
269636069cSjtc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
279636069cSjtc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
289636069cSjtc.\" SUCH DAMAGE.
299636069cSjtc.\"
309636069cSjtc.\"	@(#)jot.1	8.1 (Berkeley) 6/6/93
319636069cSjtc.\"
32*48c05140Ssimonb.Dd April 25, 2020
33a2fa91a9Smycroft.Dt JOT 1
34a2fa91a9Smycroft.Os
35a2fa91a9Smycroft.Sh NAME
36a2fa91a9Smycroft.Nm jot
37a2fa91a9Smycroft.Nd print sequential or random data
38a2fa91a9Smycroft.Sh SYNOPSIS
39990562bfSwiz.Nm
402c12af6aSpeter.Op Fl cnr
41a2fa91a9Smycroft.Op Fl b Ar word
422c12af6aSpeter.Op Fl p Ar precision
43a2fa91a9Smycroft.Op Fl s Ar string
442c12af6aSpeter.Op Fl w Ar word
45a2fa91a9Smycroft.Oo Ar reps
46a2fa91a9Smycroft.Oo Ar begin
47a2fa91a9Smycroft.Oo Ar end
48a2fa91a9Smycroft.Op Ar s
49a2fa91a9Smycroft.Oc
50a2fa91a9Smycroft.Oc
51a2fa91a9Smycroft.Oc
52a2fa91a9Smycroft.Sh DESCRIPTION
539636069cSjtcThe
54a2fa91a9Smycroft.Nm jot
55a2fa91a9Smycroftutility is used to print out increasing, decreasing, random,
56a2fa91a9Smycroftor redundant data (usually numbers) one per line.
57*48c05140SsimonbThe default is to produce sequential data.
58a2fa91a9Smycroft.Pp
59a2fa91a9SmycroftThe following options are available:
60a2fa91a9Smycroft.Bl -tag -width indent
61a2fa91a9Smycroft.It Fl b Ar word
629636069cSjtcJust print
63a2fa91a9Smycroft.Ar word
649636069cSjtcrepetitively.
65a2fa91a9Smycroft.It Fl c
66223f3c1eSjoergThis is an abbreviation for
67223f3c1eSjoerg.Fl w Ar %c .
68a2fa91a9Smycroft.It Fl n
699636069cSjtcDo not print the final newline normally appended to the output.
70a2fa91a9Smycroft.It Fl p Ar precision
719636069cSjtcPrint only as many digits or characters of the data
729636069cSjtcas indicated by the integer
73a2fa91a9Smycroft.Ar precision .
749636069cSjtcIn the absence of
75a2fa91a9Smycroft.Fl p ,
769636069cSjtcthe precision is the greater of the precisions of
77a2fa91a9Smycroft.Ar begin
789636069cSjtcand
79a2fa91a9Smycroft.Ar end .
809636069cSjtcThe
81a2fa91a9Smycroft.Fl p
829636069cSjtcoption is overridden by whatever appears in a
83a2fa91a9Smycroft.Xr printf 3
849636069cSjtcconversion following
85a2fa91a9Smycroft.Fl w .
862c12af6aSpeter.It Fl r
87*48c05140SsimonbGenerate random data.
882c12af6aSpeter.It Fl s Ar string
892c12af6aSpeterPrint data separated by
902c12af6aSpeter.Ar string .
912c12af6aSpeterNormally, newlines separate data.
922c12af6aSpeter.It Fl w Ar word
932c12af6aSpeterPrint
942c12af6aSpeter.Ar word
952c12af6aSpeterwith the generated data appended to it.
962c12af6aSpeterOctal, hexadecimal, exponential, ASCII, zero padded,
972c12af6aSpeterand right-adjusted representations
982c12af6aSpeterare possible by using the appropriate
992c12af6aSpeter.Xr printf 3
1002c12af6aSpeterconversion specification inside
1012c12af6aSpeter.Ar word ,
1022c12af6aSpeterin which case the data are inserted rather than appended.
103a2fa91a9Smycroft.El
104a2fa91a9Smycroft.Pp
1059636069cSjtcThe last four arguments indicate, respectively,
1069636069cSjtcthe number of data, the lower bound, the upper bound,
1079636069cSjtcand the step size or, for random data, the seed.
108fd983583SchristosAny argument may be omitted, and
1099636069cSjtcwill be considered as such if given as
110a2fa91a9Smycroft.Dq - .
1119636069cSjtcAny three of these arguments determines the fourth.
1129636069cSjtcIf four are specified and the given and computed values of
113a2fa91a9Smycroft.Ar reps
1149636069cSjtcconflict, the lower value is used.
1159636069cSjtcIf fewer than three are specified, defaults are assigned
1169636069cSjtcleft to right, except for
117a2fa91a9Smycroft.Ar s ,
1189636069cSjtcwhich assumes its default unless both
119a2fa91a9Smycroft.Ar begin
1209636069cSjtcand
121a2fa91a9Smycroft.Ar end
1229636069cSjtcare given.
123a2fa91a9Smycroft.Pp
124*48c05140SsimonbWhen sequential data are requested the defaults for the four arguments
125*48c05140Ssimonbare 100 data, a lower bound of 1, an upper bound of 100 and a step size
126*48c05140Ssimonbof 1.
127*48c05140SsimonbWhen random data are requested
128a2fa91a9Smycroft.Ar s
1299636069cSjtcdefaults to a seed depending upon the time of day.
130a2fa91a9Smycroft.Ar reps
1319636069cSjtcis expected to be an unsigned integer,
1329636069cSjtcand if given as zero is taken to be infinite.
133a2fa91a9Smycroft.Ar begin
1349636069cSjtcand
135a2fa91a9Smycroft.Ar end
1369636069cSjtcmay be given as real numbers or as characters
1379636069cSjtcrepresenting the corresponding value in ASCII.
1389636069cSjtcThe last argument must be a real number.
139a2fa91a9Smycroft.Pp
1409636069cSjtcRandom numbers are obtained through
141a2fa91a9Smycroft.Xr random 3 .
1429636069cSjtcThe name
143a2fa91a9Smycroft.Nm jot
1449636069cSjtcderives in part from
145a2fa91a9Smycroft.Nm iota ,
1469636069cSjtca function in APL.
147a2fa91a9Smycroft.Sh EXAMPLES
148a2fa91a9SmycroftThe command:
14971bcc2daSapb.Dl "jot - 42 87 1"
15071bcc2daSapbprints the integers from 42 to 87, inclusive.
15171bcc2daSapb.Pp
15271bcc2daSapbThe command:
153a2fa91a9Smycroft.Dl "jot 21 \-1 1.00"
1549636069cSjtcprints 21 evenly spaced numbers increasing from \-1 to 1.
155a2fa91a9Smycroft.Pp
156a2fa91a9SmycroftThe command:
157a2fa91a9Smycroft.Dl "jot \-c 128 0"
158a2fa91a9Smycroftprints the ASCII character set.
159a2fa91a9Smycroft.Pp
160a2fa91a9SmycroftThe command:
161a2fa91a9Smycroft.Dl "jot \-w xa%c 26 a"
162a2fa91a9Smycroftprints the strings
163a2fa91a9Smycroft.Dq xaa
164a2fa91a9Smycroftthrough
165a2fa91a9Smycroft.Dq xaz .
166a2fa91a9Smycroft.Pp
167a2fa91a9SmycroftThe command:
168a2fa91a9Smycroft.Dl "jot \-r \-c 160 a z | rs \-g 0 8"
169a2fa91a9Smycroftprints 20 random 8-letter strings.
170a2fa91a9Smycroft.Pp
171a2fa91a9SmycroftThe command:
172a2fa91a9Smycroft.Dl "jot \-b y 0"
173a2fa91a9Smycroftis equivalent to
174a2fa91a9Smycroft.Xr yes 1 .
175a2fa91a9Smycroft.Pp
176a2fa91a9SmycroftThe command:
177a2fa91a9Smycroft.Dl "jot \-w %ds/old/new/ 30 2 \- 5"
178a2fa91a9Smycroftprints thirty
179a2fa91a9Smycroft.Xr ed 1
180a2fa91a9Smycroftsubstitution commands applying to lines 2, 7, 12, etc.
181a2fa91a9Smycroft.Pp
182a2fa91a9SmycroftThe command:
183a2fa91a9Smycroft.Dl "jot 0 9 \- \-.5"
184e16564a1Sdslprints the stuttering sequence 9, 8, 8, 7, etc.
185a2fa91a9Smycroft.Pp
186a2fa91a9SmycroftThe command:
18701869ca4Swiz.Dl "jot \-b x 512 > block"
188a2fa91a9Smycroftcreates a file containing exactly 1024 bytes.
189a2fa91a9Smycroft.Pp
190a2fa91a9SmycroftThe command:
191a2fa91a9Smycroft.Dl "expand \-\`jot \-s, \- 10 132 4\`"
192a2fa91a9Smycroftsets tabs four spaces apart starting
193a2fa91a9Smycroftfrom column 10 and ending in column 132.
194a2fa91a9Smycroft.Pp
195a2fa91a9SmycroftThe command:
196a2fa91a9Smycroft.Dl "grep \`jot \-s """" \-b . 80\`"
197a2fa91a9Smycroftprints all lines 80 characters or longer.
198a2fa91a9Smycroft.Sh SEE ALSO
199a2fa91a9Smycroft.Xr ed 1 ,
200a2fa91a9Smycroft.Xr expand 1 ,
201a2fa91a9Smycroft.Xr rs 1 ,
20271bcc2daSapb.Xr seq 1 ,
203a2fa91a9Smycroft.Xr yes 1 ,
204a2fa91a9Smycroft.Xr printf 3 ,
205a2fa91a9Smycroft.Xr random 3
2061b333769Skamil.Sh HISTORY
2071b333769SkamilThe
2081b333769Skamil.Nm
2091b333769Skamilutility first appeared in
2101b333769Skamil.Bx 4.2 .
2111b333769Skamil.Sh AUTHORS
2121b333769Skamil.An John A. Kunze
213