19b50d902SRodney W. Grimes.\" Copyright (c) 1993 29b50d902SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 39b50d902SRodney W. Grimes.\" 49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions 69b50d902SRodney W. Grimes.\" are met: 79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 89b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 109b50d902SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 119b50d902SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 12*fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 139b50d902SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 149b50d902SRodney W. Grimes.\" without specific prior written permission. 159b50d902SRodney W. Grimes.\" 169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 199b50d902SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 269b50d902SRodney W. Grimes.\" SUCH DAMAGE. 279b50d902SRodney W. Grimes.\" 289b50d902SRodney W. Grimes.\" @(#)jot.1 8.1 (Berkeley) 6/6/93 29c3aac50fSPeter Wemm.\" $FreeBSD$ 309b50d902SRodney W. Grimes.\" 3121223660SAllan Jude.Dd April 7, 2015 32d078aa13SPhilippe Charnier.Dt JOT 1 33d078aa13SPhilippe Charnier.Os 34d078aa13SPhilippe Charnier.Sh NAME 35d078aa13SPhilippe Charnier.Nm jot 36d078aa13SPhilippe Charnier.Nd print sequential or random data 37d078aa13SPhilippe Charnier.Sh SYNOPSIS 388fe908efSRuslan Ermilov.Nm 39d078aa13SPhilippe Charnier.Op Fl cnr 40d078aa13SPhilippe Charnier.Op Fl b Ar word 41d078aa13SPhilippe Charnier.Op Fl w Ar word 42d078aa13SPhilippe Charnier.Op Fl s Ar string 43d078aa13SPhilippe Charnier.Op Fl p Ar precision 44ff9a78c0SRuslan Ermilov.Op Ar reps Op Ar begin Op Ar end Op Ar s 45d078aa13SPhilippe Charnier.Sh DESCRIPTION 46e8937ba0SPhilippe CharnierThe 47e8937ba0SPhilippe Charnier.Nm 48e8937ba0SPhilippe Charnierutility is used to print out increasing, decreasing, random, 499b50d902SRodney W. Grimesor redundant data, usually numbers, one per line. 50d078aa13SPhilippe Charnier.Pp 51d078aa13SPhilippe CharnierThe following options are available: 52d078aa13SPhilippe Charnier.Bl -tag -width indent 53d078aa13SPhilippe Charnier.It Fl r 5486fb9103SSteve PriceGenerate random data instead of the default sequential data. 55d078aa13SPhilippe Charnier.It Fl b Ar word 569b50d902SRodney W. GrimesJust print 57d078aa13SPhilippe Charnier.Ar word 589b50d902SRodney W. Grimesrepetitively. 59d078aa13SPhilippe Charnier.It Fl w Ar word 609b50d902SRodney W. GrimesPrint 61d078aa13SPhilippe Charnier.Ar word 629b50d902SRodney W. Grimeswith the generated data appended to it. 63d078aa13SPhilippe CharnierOctal, hexadecimal, exponential, 64d078aa13SPhilippe Charnier.Tn ASCII , 65d078aa13SPhilippe Charnierzero padded, 669b50d902SRodney W. Grimesand right-adjusted representations 679b50d902SRodney W. Grimesare possible by using the appropriate 68d078aa13SPhilippe Charnier.Xr printf 3 699b50d902SRodney W. Grimesconversion specification inside 70d078aa13SPhilippe Charnier.Ar word , 719b50d902SRodney W. Grimesin which case the data are inserted rather than appended. 72d078aa13SPhilippe Charnier.It Fl c 73d078aa13SPhilippe CharnierThis is an abbreviation for 74d078aa13SPhilippe Charnier.Fl w Ar %c . 75d078aa13SPhilippe Charnier.It Fl s Ar string 769b50d902SRodney W. GrimesPrint data separated by 77d078aa13SPhilippe Charnier.Ar string . 789b50d902SRodney W. GrimesNormally, newlines separate data. 79d078aa13SPhilippe Charnier.It Fl n 809b50d902SRodney W. GrimesDo not print the final newline normally appended to the output. 81d078aa13SPhilippe Charnier.It Fl p Ar precision 829b50d902SRodney W. GrimesPrint only as many digits or characters of the data 839b50d902SRodney W. Grimesas indicated by the integer 84d078aa13SPhilippe Charnier.Ar precision . 859b50d902SRodney W. GrimesIn the absence of 86d078aa13SPhilippe Charnier.Fl p , 879b50d902SRodney W. Grimesthe precision is the greater of the precisions of 88d078aa13SPhilippe Charnier.Ar begin 899b50d902SRodney W. Grimesand 90d078aa13SPhilippe Charnier.Ar end . 919b50d902SRodney W. GrimesThe 92d078aa13SPhilippe Charnier.Fl p 939b50d902SRodney W. Grimesoption is overridden by whatever appears in a 94d078aa13SPhilippe Charnier.Xr printf 3 959b50d902SRodney W. Grimesconversion following 96d078aa13SPhilippe Charnier.Fl w . 97d078aa13SPhilippe Charnier.El 98d078aa13SPhilippe Charnier.Pp 999b50d902SRodney W. GrimesThe last four arguments indicate, respectively, 1009b50d902SRodney W. Grimesthe number of data, the lower bound, the upper bound, 1019b50d902SRodney W. Grimesand the step size or, for random data, the seed. 1029b50d902SRodney W. GrimesWhile at least one of them must appear, 1039b50d902SRodney W. Grimesany of the other three may be omitted, and 1049b50d902SRodney W. Grimeswill be considered as such if given as 105fee14f30SDiomidis Spinellis.Fl "" 106fee14f30SDiomidis Spinellisor as an empty string. 1079b50d902SRodney W. GrimesAny three of these arguments determines the fourth. 1089b50d902SRodney W. GrimesIf four are specified and the given and computed values of 109d078aa13SPhilippe Charnier.Ar reps 1109b50d902SRodney W. Grimesconflict, the lower value is used. 1119b50d902SRodney W. GrimesIf fewer than three are specified, defaults are assigned 1129b50d902SRodney W. Grimesleft to right, except for 113d078aa13SPhilippe Charnier.Ar s , 1147d71f06cSDiomidis Spinelliswhich assumes a default of 1 or -1 if both 115d078aa13SPhilippe Charnier.Ar begin 1169b50d902SRodney W. Grimesand 117d078aa13SPhilippe Charnier.Ar end 1189b50d902SRodney W. Grimesare given. 119d078aa13SPhilippe Charnier.Pp 1209b50d902SRodney W. GrimesDefaults for the four arguments are, respectively, 1219b50d902SRodney W. Grimes100, 1, 100, and 1, except that when random data are requested, 12286fb9103SSteve Pricethe seed, 12386fb9103SSteve Price.Ar s , 12486fb9103SSteve Priceis picked randomly. 125ff9a78c0SRuslan ErmilovThe 126ff9a78c0SRuslan Ermilov.Ar reps 127ff9a78c0SRuslan Ermilovargument is expected to be an unsigned integer, 1289b50d902SRodney W. Grimesand if given as zero is taken to be infinite. 129ff9a78c0SRuslan ErmilovThe 130ff9a78c0SRuslan Ermilov.Ar begin 1319b50d902SRodney W. Grimesand 132d078aa13SPhilippe Charnier.Ar end 133ff9a78c0SRuslan Ermilovarguments may be given as real numbers or as characters 134d078aa13SPhilippe Charnierrepresenting the corresponding value in 135d078aa13SPhilippe Charnier.Tn ASCII . 1369b50d902SRodney W. GrimesThe last argument must be a real number. 137d078aa13SPhilippe Charnier.Pp 1389b50d902SRodney W. GrimesRandom numbers are obtained through 139a26a6612SDiomidis Spinellis.Xr arc4random 3 140a26a6612SDiomidis Spinelliswhen no seed is specified, 141a26a6612SDiomidis Spinellisand through 142a26a6612SDiomidis Spinellis.Xr random 3 143a26a6612SDiomidis Spinelliswhen a seed is given. 144d129c68aSDiomidis SpinellisWhen 145d129c68aSDiomidis Spinellis.Nm 146d129c68aSDiomidis Spinellisis asked to generate random integers or characters with begin 147d129c68aSDiomidis Spinellisand end values in the range of the random number generator function 148d129c68aSDiomidis Spinellisand no format is specified with one of the 149d129c68aSDiomidis Spinellis.Fl w , 150d129c68aSDiomidis Spinellis.Fl b , 151d129c68aSDiomidis Spinellisor 152d129c68aSDiomidis Spinellis.Fl p 153d129c68aSDiomidis Spinellisoptions, 154d129c68aSDiomidis Spinellis.Nm 155d129c68aSDiomidis Spinelliswill arrange for all the values in the range to appear in the output 156d129c68aSDiomidis Spinelliswith an equal probability. 157d129c68aSDiomidis SpinellisIn all other cases be careful to ensure that the output format's 158d129c68aSDiomidis Spinellisrounding or truncation will not skew the distribution of output 159d129c68aSDiomidis Spinellisvalues in an unintended way. 160d129c68aSDiomidis Spinellis.Pp 1619b50d902SRodney W. GrimesThe name 162d078aa13SPhilippe Charnier.Nm 1639b50d902SRodney W. Grimesderives in part from 164d078aa13SPhilippe Charnier.Nm iota , 1659b50d902SRodney W. Grimesa function in APL. 1669c24af3dSBrian Somers.Ss Rounding and truncation 1679c24af3dSBrian SomersThe 1689c24af3dSBrian Somers.Nm 1699c24af3dSBrian Somersutility uses double precision floating point arithmetic internally. 1709c24af3dSBrian SomersBefore printing a number, it is converted depending on the output 1719c24af3dSBrian Somersformat used. 1729c24af3dSBrian Somers.Pp 1739c24af3dSBrian SomersIf no output format is specified or the output format is a 1749c24af3dSBrian Somersfloating point format 1759c24af3dSBrian Somers.Po 1769c24af3dSBrian Somers.Sq E , 1779c24af3dSBrian Somers.Sq G , 1789c24af3dSBrian Somers.Sq e , 1799c24af3dSBrian Somers.Sq f , 1809c24af3dSBrian Somersor 1819c24af3dSBrian Somers.Sq g 1829c24af3dSBrian Somers.Pc , 1839c24af3dSBrian Somersthe value is rounded using the 1849c24af3dSBrian Somers.Xr printf 3 1859c24af3dSBrian Somersfunction, taking into account the requested precision. 1869c24af3dSBrian Somers.Pp 1879c24af3dSBrian SomersIf the output format is an integer format 1889c24af3dSBrian Somers.Po 1899c24af3dSBrian Somers.Sq D , 1909c24af3dSBrian Somers.Sq O , 1919c24af3dSBrian Somers.Sq U , 1929c24af3dSBrian Somers.Sq X , 1939c24af3dSBrian Somers.Sq c , 1949c24af3dSBrian Somers.Sq d , 1959c24af3dSBrian Somers.Sq i , 1969c24af3dSBrian Somers.Sq o , 1979c24af3dSBrian Somers.Sq u , 1989c24af3dSBrian Somersor 1999c24af3dSBrian Somers.Sq x 2009c24af3dSBrian Somers.Pc , 2019c24af3dSBrian Somersthe value is converted to an integer value by truncation. 2029c24af3dSBrian Somers.Pp 2039c24af3dSBrian SomersAs an illustration, consider the following command: 2049c24af3dSBrian Somers.Bd -literal -offset indent 2059c24af3dSBrian Somers$ jot 6 1 10 0.5 2069c24af3dSBrian Somers1 2079c24af3dSBrian Somers2 2089c24af3dSBrian Somers2 2099c24af3dSBrian Somers2 2109c24af3dSBrian Somers3 2119c24af3dSBrian Somers4 2129c24af3dSBrian Somers.Ed 2139c24af3dSBrian Somers.Pp 2149c24af3dSBrian SomersBy requesting an explicit precision of 1, the values generated before rounding 2159c24af3dSBrian Somerscan be seen. 2169c24af3dSBrian SomersThe .5 values are rounded down if the integer part is even, 2179c24af3dSBrian Somersup otherwise. 2189c24af3dSBrian Somers.Bd -literal -offset indent 2199c24af3dSBrian Somers$ jot -p 1 6 1 10 0.5 2209c24af3dSBrian Somers1.0 2219c24af3dSBrian Somers1.5 2229c24af3dSBrian Somers2.0 2239c24af3dSBrian Somers2.5 2249c24af3dSBrian Somers3.0 2259c24af3dSBrian Somers3.5 2269c24af3dSBrian Somers.Ed 2279c24af3dSBrian Somers.Pp 2289c24af3dSBrian SomersBy offsetting the values slightly, the values generated by the following 2299c24af3dSBrian Somerscommand are always rounded down: 2309c24af3dSBrian Somers.Bd -literal -offset indent 2319c24af3dSBrian Somers$ jot -p 0 6 .9999999999 10 0.5 2329c24af3dSBrian Somers1 2339c24af3dSBrian Somers1 2349c24af3dSBrian Somers2 2359c24af3dSBrian Somers2 2369c24af3dSBrian Somers3 2379c24af3dSBrian Somers3 2389c24af3dSBrian Somers.Ed 2399c24af3dSBrian Somers.Pp 2409c24af3dSBrian SomersAnother way of achieving the same result is to force truncation by 2419c24af3dSBrian Somersspecifying an integer format: 2429c24af3dSBrian Somers.Bd -literal -offset indent 2439c24af3dSBrian Somers$ jot -w %d 6 1 10 0.5 2449c24af3dSBrian Somers.Ed 2456c7216dfSRuslan Ermilov.Sh EXIT STATUS 2466c7216dfSRuslan Ermilov.Ex -std 247d078aa13SPhilippe Charnier.Sh EXAMPLES 2489b50d902SRodney W. GrimesThe command 2497d71f06cSDiomidis Spinellis.Dl jot - 1 10 2507d71f06cSDiomidis Spinellis.Pp 2517d71f06cSDiomidis Spinellisprints the integers from 1 to 10, 2527d71f06cSDiomidis Spinelliswhile the command 253d078aa13SPhilippe Charnier.Dl jot 21 -1 1.00 254d078aa13SPhilippe Charnier.Pp 255d078aa13SPhilippe Charnierprints 21 evenly spaced numbers increasing from -1 to 1. 256d078aa13SPhilippe CharnierThe 257d078aa13SPhilippe Charnier.Tn ASCII 258d078aa13SPhilippe Charniercharacter set is generated with 259d078aa13SPhilippe Charnier.Dl jot -c 128 0 260d078aa13SPhilippe Charnier.Pp 2619b50d902SRodney W. Grimesand the strings xaa through xaz with 262d078aa13SPhilippe Charnier.Dl jot -w xa%c 26 a 263d078aa13SPhilippe Charnier.Pp 2649b50d902SRodney W. Grimeswhile 20 random 8-letter strings are produced with 265d078aa13SPhilippe Charnier.Dl "jot -r -c 160 a z | rs -g 0 8" 266d078aa13SPhilippe Charnier.Pp 2679b50d902SRodney W. GrimesInfinitely many 268d078aa13SPhilippe Charnier.Em yes Ns 's 2699b50d902SRodney W. Grimesmay be obtained through 270d078aa13SPhilippe Charnier.Dl jot -b yes 0 271d078aa13SPhilippe Charnier.Pp 2729b50d902SRodney W. Grimesand thirty 273d078aa13SPhilippe Charnier.Xr ed 1 2746a3e8b0aSRuslan Ermilovsubstitution commands applying to lines 2, 7, 12, etc.\& is 2759b50d902SRodney W. Grimesthe result of 276d078aa13SPhilippe Charnier.Dl jot -w %ds/old/new/ 30 2 - 5 277d078aa13SPhilippe Charnier.Pp 2786a3e8b0aSRuslan ErmilovThe stuttering sequence 9, 9, 8, 8, 7, etc.\& can be 2799c24af3dSBrian Somersproduced by truncating the output precision and a suitable choice of step size, 2809b50d902SRodney W. Grimesas in 2819c24af3dSBrian Somers.Dl jot -w %d - 9.5 0 -.5 282d078aa13SPhilippe Charnier.Pp 2839b50d902SRodney W. Grimesand a file containing exactly 1024 bytes is created with 284d078aa13SPhilippe Charnier.Dl jot -b x 512 > block 285d078aa13SPhilippe Charnier.Pp 2869b50d902SRodney W. GrimesFinally, to set tabs four spaces apart starting 2879b50d902SRodney W. Grimesfrom column 10 and ending in column 132, use 288d078aa13SPhilippe Charnier.Dl expand -`jot -s, - 10 132 4` 289d078aa13SPhilippe Charnier.Pp 2909b50d902SRodney W. Grimesand to print all lines 80 characters or longer, 291d078aa13SPhilippe Charnier.Dl grep `jot -s \&"\&" -b \&. 80` 292a866e170SRuslan Ermilov.Sh DIAGNOSTICS 2935249bd84SSheldon HearnThe following diagnostic messages deserve special explanation: 2945249bd84SSheldon Hearn.Bl -diag 2955249bd84SSheldon Hearn.It "illegal or unsupported format '%s'" 2965249bd84SSheldon HearnThe requested conversion format specifier for 2978db8a33bSSheldon Hearn.Xr printf 3 2985249bd84SSheldon Hearnwas not of the form 2998db8a33bSSheldon Hearn.Dl %[#][ ][{+,-}][0-9]*[.[0-9]*]? 3008db8a33bSSheldon Hearnwhere 3019b88faecSRuslan Ermilov.Dq ?\& 3028db8a33bSSheldon Hearnmust be one of 3038db8a33bSSheldon Hearn.Dl [l]{d,i,o,u,x} 3048db8a33bSSheldon Hearnor 3058db8a33bSSheldon Hearn.Dl {c,e,f,g,D,E,G,O,U,X} 3065249bd84SSheldon Hearn.It "range error in conversion" 3075249bd84SSheldon HearnA value to be printed fell outside the range of the data type 3085249bd84SSheldon Hearnassociated with the requested output format. 3095249bd84SSheldon Hearn.It "too many conversions" 3105249bd84SSheldon HearnMore than one conversion format specifier has been supplied, 3115249bd84SSheldon Hearnbut only one is allowed. 3125249bd84SSheldon Hearn.El 3135249bd84SSheldon Hearn.Sh SEE ALSO 3145249bd84SSheldon Hearn.Xr ed 1 , 3155249bd84SSheldon Hearn.Xr expand 1 , 3165249bd84SSheldon Hearn.Xr rs 1 , 3179b3e11b8SXin LI.Xr seq 1 , 3185249bd84SSheldon Hearn.Xr yes 1 , 3191ab8c5beSDiomidis Spinellis.Xr arc4random 3 , 3205249bd84SSheldon Hearn.Xr printf 3 , 3215249bd84SSheldon Hearn.Xr random 3 32204f064d6SColin Percival.Sh HISTORY 32304f064d6SColin PercivalThe 32404f064d6SColin Percival.Nm 32504f064d6SColin Percivalutility first appeared in 32604f064d6SColin Percival.Bx 4.2 . 32721223660SAllan Jude.Sh AUTHORS 32821223660SAllan Jude.An John A. Kunze 329