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