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