1*9bc9835aSwiz.\" $NetBSD: seq.1,v 1.12 2022/02/28 13:49:50 wiz Exp $ 2e8c23208Sginsbach.\" 3e8c23208Sginsbach.\" Copyright (c) 2005 The NetBSD Foundation, Inc. 4e8c23208Sginsbach.\" All rights reserved. 5e8c23208Sginsbach.\" 6e8c23208Sginsbach.\" This code is derived from software contributed to The NetBSD Foundation 7cf8e68cbSginsbach.\" by Brian Ginsbach. 8e8c23208Sginsbach.\" 9e8c23208Sginsbach.\" Redistribution and use in source and binary forms, with or without 10e8c23208Sginsbach.\" modification, are permitted provided that the following conditions 11e8c23208Sginsbach.\" are met: 12e8c23208Sginsbach.\" 1. Redistributions of source code must retain the above copyright 13e8c23208Sginsbach.\" notice, this list of conditions and the following disclaimer. 14e8c23208Sginsbach.\" 2. Redistributions in binary form must reproduce the above copyright 15e8c23208Sginsbach.\" notice, this list of conditions and the following disclaimer in the 16e8c23208Sginsbach.\" documentation and/or other materials provided with the distribution. 17e8c23208Sginsbach.\" 18e8c23208Sginsbach.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19e8c23208Sginsbach.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20e8c23208Sginsbach.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21e8c23208Sginsbach.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22e8c23208Sginsbach.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23e8c23208Sginsbach.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24e8c23208Sginsbach.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25e8c23208Sginsbach.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26e8c23208Sginsbach.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27e8c23208Sginsbach.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28e8c23208Sginsbach.\" POSSIBILITY OF SUCH DAMAGE. 29e8c23208Sginsbach.\" 30e8c23208Sginsbach.\" 3107ed41e7Schristos.Dd December 17, 2018 32e8c23208Sginsbach.Dt SEQ 1 33e8c23208Sginsbach.Os 34e8c23208Sginsbach.Sh NAME 35e8c23208Sginsbach.Nm seq 36e8c23208Sginsbach.Nd print sequences of numbers 37e8c23208Sginsbach.Sh SYNOPSIS 38e8c23208Sginsbach.Nm 39c6bb1f47Swiz.Op Fl w 40e8c23208Sginsbach.Op Fl f Ar format 41e8c23208Sginsbach.Op Fl s Ar string 42e8c23208Sginsbach.Op Fl t Ar string 43e8c23208Sginsbach.Op Ar first Op Ar incr 44e8c23208Sginsbach.Ar last 45e8c23208Sginsbach.Sh DESCRIPTION 46e8c23208SginsbachThe 47e8c23208Sginsbach.Nm 48*9bc9835aSwizutility prints a sequence of numbers, one per line by default, 49e8c23208Sginsbachfrom 50e8c23208Sginsbach.Ar first 51*9bc9835aSwiz.Pq default 1 52*9bc9835aSwizto as near 53e8c23208Sginsbach.Ar last 54e8c23208Sginsbachas possible, in increments of 55e8c23208Sginsbach.Ar incr 56e8c23208Sginsbach.Pq default 1 . 57e8c23208SginsbachWhen 58e8c23208Sginsbach.Ar first 59e8c23208Sginsbachis larger than 602c8eda20Sjdf.Ar last , 61e8c23208Sginsbachthe default 62e8c23208Sginsbach.Ar incr 63e8c23208Sginsbachis -1. 64e8c23208Sginsbach.Pp 65e8c23208SginsbachAll numbers are interpreted as floating point. 66e8c23208Sginsbach.Pp 67e8c23208SginsbachNormally integer values are printed as decimal integers. 68e8c23208Sginsbach.Pp 69e8c23208SginsbachThe 70e8c23208Sginsbach.Nm 71e8c23208Sginsbachutility accepts the following options: 72e8c23208Sginsbach.Bl -tag -width Ar 73e8c23208Sginsbach.It Fl f Ar format 74e8c23208SginsbachUse a 75e8c23208Sginsbach.Xr printf 3 76e8c23208Sginsbachstyle 77e8c23208Sginsbach.Ar format 78bfd03efdSginsbachto print each number. 79bfd03efdSginsbachOnly the 8076c7c8ecSdholland.Cm A , 8176c7c8ecSdholland.Cm a , 82e8c23208Sginsbach.Cm E , 83c6bb1f47Swiz.Cm e , 8476c7c8ecSdholland.Cm F , 85e8c23208Sginsbach.Cm f , 86e8c23208Sginsbach.Cm G , 87c6bb1f47Swiz.Cm g , 88e8c23208Sginsbachand 89e8c23208Sginsbach.Cm % 90e8c23208Sginsbachconversion characters are valid, along with any optional 919a662625Sandvarflags and an optional numeric minimum field width or precision. 92e8c23208SginsbachThe 93e8c23208Sginsbach.Ar format 94e8c23208Sginsbachcan contain character escape sequences in backslash notation as 95e8c23208Sginsbachdefined in 96e8c23208Sginsbach.St -ansiC . 97e8c23208SginsbachThe default is 98e8c23208Sginsbach.Cm %g . 99e8c23208Sginsbach.It Fl s Ar string 100e8c23208SginsbachUse 101e8c23208Sginsbach.Ar string 102e8c23208Sginsbachto separate numbers. 103e8c23208SginsbachThe 104e8c23208Sginsbach.Ar string 105e8c23208Sginsbachcan contain character escape sequences in backslash notation as 106e8c23208Sginsbachdefined in 107e8c23208Sginsbach.St -ansiC . 108e8c23208SginsbachThe default is 109e8c23208Sginsbach.Cm \en . 110e8c23208Sginsbach.It Fl t Ar string 111e8c23208SginsbachUse 112e8c23208Sginsbach.Ar string 113e8c23208Sginsbachto terminate sequence of numbers. 114e8c23208SginsbachThe 115e8c23208Sginsbach.Ar string 116e8c23208Sginsbachcan contain character escape sequences in backslash notation as 117e8c23208Sginsbachdefined in 118e8c23208Sginsbach.St -ansiC . 11907ed41e7SchristosThe default is 120e8c23208Sginsbach.Cm \en . 121e8c23208Sginsbach.It Fl w 122e8c23208SginsbachEqualize the widths of all numbers by padding with zeros as necessary. 123e8c23208SginsbachThis option has no effect with the 124e8c23208Sginsbach.Fl f 125e8c23208Sginsbachoption. 126e8c23208SginsbachIf any sequence numbers will be printed in exponential notation, 127e8c23208Sginsbachthe default conversion is changed to 128e8c23208Sginsbach.Cm %e . 129e8c23208Sginsbach.El 1302c8eda20Sjdf.Sh EXIT STATUS 1312c8eda20Sjdf.Ex -std 132e8c23208Sginsbach.Sh EXAMPLES 133*9bc9835aSwizGenerate a sequence from 1 to 3 (inclusive) with a default increment of 1: 134e8c23208Sginsbach.Bd -literal -offset indent 135*9bc9835aSwiz$ seq 1 3 136e8c23208Sginsbach1 137e8c23208Sginsbach2 138e8c23208Sginsbach3 139*9bc9835aSwiz.Ed 140*9bc9835aSwiz.Pp 141*9bc9835aSwizGenerate a sequence from 3 to 1 (inclusive) with a default increment of -1: 142*9bc9835aSwiz.Bd -literal -offset indent 143*9bc9835aSwiz$ seq 3 1 144e8c23208Sginsbach3 145e8c23208Sginsbach2 146e8c23208Sginsbach1 147*9bc9835aSwiz.Ed 148*9bc9835aSwiz.Pp 149*9bc9835aSwizGenerate a sequence from 0 to 0.1 (inclusive) with an increment of 0.05 150*9bc9835aSwizand padding with leading zeroes: 151*9bc9835aSwiz.Bd -literal -offset indent 152*9bc9835aSwiz$ seq -w 0 .05 .1 153e8c23208Sginsbach0.00 154e8c23208Sginsbach0.05 155e8c23208Sginsbach0.10 156e8c23208Sginsbach.Ed 157*9bc9835aSwiz.Pp 158*9bc9835aSwizGenerate a sequence from 1 to 3 (inclusive) with a default increment of 1, 159*9bc9835aSwizand a custom separator string: 160*9bc9835aSwiz.Bd -literal -offset indent 161*9bc9835aSwiz$ seq -s "," 1 3 162*9bc9835aSwiz1,2,3 163*9bc9835aSwiz.Ed 164*9bc9835aSwiz.Pp 165*9bc9835aSwizGenerate a sequence from 1 to 2 (inclusive) with an increment of 0.2 and 166*9bc9835aSwizprint the results with two digits after the decimal point (using a 167*9bc9835aSwiz.Xr printf 3 168*9bc9835aSwizstyle format): 169*9bc9835aSwiz.Bd -literal -offset indent 170*9bc9835aSwiz$ seq -f %.2f 1 0.2 2 171*9bc9835aSwiz1.00 172*9bc9835aSwiz1.20 173*9bc9835aSwiz1.40 174*9bc9835aSwiz1.60 175*9bc9835aSwiz1.80 176*9bc9835aSwiz2.00 177*9bc9835aSwiz.Ed 178e8c23208Sginsbach.Sh SEE ALSO 179e8c23208Sginsbach.Xr jot 1 , 180e8c23208Sginsbach.Xr printf 1 , 181e8c23208Sginsbach.Xr printf 3 182e8c23208Sginsbach.Sh HISTORY 183e8c23208SginsbachThe 184e8c23208Sginsbach.Nm 185fbe5805eSsevancommand first appeared in Version\~8 186fbe5805eSsevan.At . 187e8c23208SginsbachA 188e8c23208Sginsbach.Nm 189e8c23208Sginsbachcommand appeared in 190e8c23208Sginsbach.Nx 3.0 . 191e8c23208SginsbachThis command was based on the command of the same name in 192e8c23208Sginsbach.Tn "Plan 9 from Bell Labs" 193e8c23208Sginsbachand the 194e8c23208Sginsbach.Tn GNU 195e8c23208Sginsbachcore utilities. 196e8c23208SginsbachThe 197e8c23208Sginsbach.Tn GNU 198e8c23208Sginsbach.Nm 199e8c23208Sginsbachcommand first appeared in the 1.13 shell utilities release. 200e8c23208Sginsbach.Sh BUGS 201e8c23208SginsbachThe 202e8c23208Sginsbach.Fl w 203e8c23208Sginsbachoption does not handle the transition from pure floating point 204e8c23208Sginsbachto exponent representation very well. 205e8c23208SginsbachThe 206e8c23208Sginsbach.Nm 207fbe5805eSsevancommand is not bug for bug compatible with other implementations. 208