Annotation of src/usr.bin/jot/jot.1, Revision 1.13
1.13 ! otto 1: .\" $OpenBSD: jot.1,v 1.12 2003/12/18 11:51:13 jmc 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
1.11 jmc 41: .Bk -words
1.3 aaron 42: .Op Fl cnr
43: .Op Fl b Ar word
1.11 jmc 44: .Op Fl p Ar precision
45: .Op Fl s Ar string
1.3 aaron 46: .Op Fl w Ar word
47: .Oo Ar reps Oo Ar begin Oo Ar end
48: .Oo Ar s Oc Oc Oc Oc
1.11 jmc 49: .Ek
1.3 aaron 50: .Sh DESCRIPTION
51: .Nm
1.1 deraadt 52: is used to print out increasing, decreasing, random,
53: or redundant data, usually numbers, one per line.
1.3 aaron 54: .Pp
55: The options are as follows:
1.11 jmc 56: .Bl -tag -width "-p precision"
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 c
62: This is an abbreviation for
63: .Fl w Ic %c .
64: .It Fl n
1.1 deraadt 65: Do not print the final newline normally appended to the output.
1.3 aaron 66: .It Fl p Ar precision
1.1 deraadt 67: Print only as many digits or characters of the data
68: as indicated by the integer
1.3 aaron 69: .Ar precision .
1.1 deraadt 70: In the absence of
1.3 aaron 71: .Fl p ,
72: the precision is the greater of the numbers
73: .Ar begin
1.1 deraadt 74: and
1.3 aaron 75: .Ar end .
1.1 deraadt 76: The
1.3 aaron 77: .Fl p
1.1 deraadt 78: option is overridden by whatever appears in a
1.3 aaron 79: .Xr printf 3
1.1 deraadt 80: conversion following
1.3 aaron 81: .Fl w .
1.11 jmc 82: .It Fl r
83: Generate random data.
84: By default,
85: .Nm
86: generates sequential data.
87: .It Fl s Ar string
88: Print data separated by
89: .Ar string .
90: Normally, newlines separate data.
91: .It Fl w Ar word
92: Print
93: .Ar word
94: with the generated data appended to it.
95: Octal, hexadecimal, exponential, ASCII, zero-padded,
96: and right-adjusted representations
97: are possible by using the appropriate
98: .Xr printf 3
99: conversion specification inside
100: .Ar word ,
101: in which case the data is inserted rather than appended.
1.5 aaron 102: .El
1.3 aaron 103: .Pp
1.1 deraadt 104: The last four arguments indicate, respectively,
1.11 jmc 105: the maximum number of data, the lower bound, the upper bound,
1.13 ! otto 106: and the step size.
1.1 deraadt 107: While at least one of them must appear,
108: any of the other three may be omitted, and
109: will be considered as such if given as
1.3 aaron 110: .Ql - .
1.1 deraadt 111: Any three of these arguments determines the fourth.
112: If four are specified and the given and computed values of
1.3 aaron 113: .Ar reps
1.1 deraadt 114: conflict, the lower value is used.
115: If fewer than three are specified, defaults are assigned
116: left to right, except for
1.3 aaron 117: .Ar s ,
1.1 deraadt 118: which assumes its default unless both
1.3 aaron 119: .Ar begin
1.1 deraadt 120: and
1.3 aaron 121: .Ar end
1.1 deraadt 122: are given.
1.3 aaron 123: .Pp
1.1 deraadt 124: Defaults for the four arguments are, respectively,
1.13 ! otto 125: 100, 1, 100, and 1.
1.3 aaron 126: .Ar reps
1.1 deraadt 127: is expected to be an unsigned integer,
128: and if given as zero is taken to be infinite.
1.3 aaron 129: .Ar begin
1.1 deraadt 130: and
1.3 aaron 131: .Ar end
1.1 deraadt 132: may be given as real numbers or as characters
133: representing the corresponding value in ASCII.
134: The last argument must be a real number.
1.3 aaron 135: .Pp
1.1 deraadt 136: Random numbers are obtained through
1.12 jmc 137: .Xr arc4random 3 .
1.13 ! otto 138: Historical versions of
! 139: .Nm
! 140: used
! 141: .Ar s
! 142: to seed the random number generator.
! 143: This is no longer supported.
1.1 deraadt 144: The name
1.3 aaron 145: .Nm
1.1 deraadt 146: derives in part from
1.3 aaron 147: .Xr iota ,
1.1 deraadt 148: a function in APL.
1.3 aaron 149: .Sh EXAMPLES
1.11 jmc 150: Print 21 evenly spaced numbers increasing from \-1 to 1:
1.3 aaron 151: .Pp
1.8 deraadt 152: .Dl $ jot 21 \-1 1.00
1.3 aaron 153: .Pp
1.11 jmc 154: Generate the ASCII character set:
1.3 aaron 155: .Pp
1.8 deraadt 156: .Dl $ jot \-c 128 0
1.3 aaron 157: .Pp
1.11 jmc 158: Generate the strings xaa through xaz:
1.3 aaron 159: .Pp
1.8 deraadt 160: .Dl $ jot \-w xa%c 26 a
1.3 aaron 161: .Pp
1.11 jmc 162: Generate 20 random 8-letter strings:
1.3 aaron 163: .Pp
1.8 deraadt 164: .Dl "$ jot \-r \-c 160 a z | rs \-g 0 8"
1.3 aaron 165: .Pp
1.1 deraadt 166: Infinitely many
1.3 aaron 167: .Xr yes 1 's
1.11 jmc 168: may be obtained through:
1.3 aaron 169: .Pp
1.8 deraadt 170: .Dl $ jot \-b yes 0
1.3 aaron 171: .Pp
1.11 jmc 172: Thirty
1.3 aaron 173: .Xr ed 1
1.11 jmc 174: substitution commands applying to lines 2, 7, 12, etc. is the result of:
1.3 aaron 175: .Pp
1.8 deraadt 176: .Dl $ jot \-w %ds/old/new/ 30 2 \- 5
1.3 aaron 177: .Pp
1.1 deraadt 178: The stuttering sequence 9, 9, 8, 8, 7, etc. can be
1.11 jmc 179: produced by suitable choice of precision and step size:
1.3 aaron 180: .Pp
1.11 jmc 181: .Dl $ jot 20 9 0 \-.475
1.3 aaron 182: .Pp
1.11 jmc 183: Create a file containing exactly 1024 bytes:
1.3 aaron 184: .Pp
1.8 deraadt 185: .Dl $ jot \-b x 512 > block
1.3 aaron 186: .Pp
1.11 jmc 187: To set tabs four spaces apart starting
188: from column 10 and ending in column 132, use:
1.3 aaron 189: .Pp
1.11 jmc 190: .Dl $ expand \-`jot \-s, \- 10 132 4`
1.3 aaron 191: .Pp
1.11 jmc 192: To print all lines 80 characters or longer:
1.3 aaron 193: .Pp
1.11 jmc 194: .Dl $ grep `jot \-s \&"\&" \-b . 80`
1.3 aaron 195: .Sh SEE ALSO
196: .Xr ed 1 ,
197: .Xr expand 1 ,
198: .Xr rs 1 ,
199: .Xr yes 1 ,
1.12 jmc 200: .Xr arc4random 3 ,
201: .Xr printf 3