1.\" $OpenBSD: seq.1,v 1.6 2023/09/21 13:51:50 jsg Exp $ 2.\" 3.\" Copyright (c) 2005 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Brian Ginsbach. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd $Mdocdate: September 21 2023 $ 31.Dt SEQ 1 32.Os 33.Sh NAME 34.Nm seq 35.Nd print sequences of numbers 36.Sh SYNOPSIS 37.Nm 38.Op Fl w 39.Op Fl f Ar format 40.Op Fl s Ar string 41.Op Ar first Op Ar incr 42.Ar last 43.Sh DESCRIPTION 44The 45.Nm 46utility prints a sequence of numbers, one per line by default, 47from 48.Ar first 49.Pq default 1 50to as near 51.Ar last 52as possible, in increments of 53.Ar incr 54.Pq default 1 . 55When 56.Ar first 57is larger than 58.Ar last , 59the default 60.Ar incr 61is -1. 62.Pp 63All numbers are interpreted as floating point. 64.Pp 65Normally, integer values are printed as decimal integers. 66.Pp 67The 68.Nm 69utility accepts the following options: 70.Bl -tag -width Ar 71.It Fl f Ar format , Fl -format Ar format 72Use a 73.Xr printf 3 74style 75.Ar format 76to print each number. 77Only the 78.Cm A , 79.Cm a , 80.Cm E , 81.Cm e , 82.Cm F , 83.Cm f , 84.Cm G , 85.Cm g , 86and 87.Cm % 88conversion characters are valid, along with any optional 89flags and an optional numeric minimum field width or precision. 90The 91.Ar format 92can contain character escape sequences in backslash notation as 93defined in 94.St -ansiC . 95The default is 96.Cm %g . 97.It Fl s Ar string , Fl -separator Ar string 98Use 99.Ar string 100to separate numbers. 101The 102.Ar string 103can contain character escape sequences in backslash notation as 104defined in 105.St -ansiC . 106The default is 107.Cm \en . 108.It Fl w , Fl -fixed-width 109Equalize the widths of all numbers by padding with zeros as necessary. 110This option has no effect with the 111.Fl f 112option. 113If any sequence numbers will be printed in exponential notation, 114the default conversion is changed to 115.Cm %e . 116.It Fl -help 117Display the program usage and exit. 118.It Fl -version 119Display the version number and exit. 120.El 121.Sh EXIT STATUS 122.Ex -std 123.Sh EXAMPLES 124Generate a sequence from 1 to 3 (inclusive) with a default increment of 1: 125.Bd -literal -offset indent 126$ seq 1 3 1271 1282 1293 130.Ed 131.Pp 132Generate a sequence from 3 to 1 (inclusive) with a default increment of -1: 133.Bd -literal -offset indent 134$ seq 3 1 1353 1362 1371 138.Ed 139.Pp 140Generate a sequence from 0 to 0.1 (inclusive) with an increment of 0.05 141and padding with leading zeroes: 142.Bd -literal -offset indent 143$ seq -w 0 .05 .1 1440.00 1450.05 1460.10 147.Ed 148.Pp 149Generate a sequence from 1 to 3 (inclusive) with a default increment of 1, 150and a custom separator string: 151.Bd -literal -offset indent 152$ seq -s "," 1 3 1531,2,3 154.Ed 155.Pp 156Generate a sequence from 1 to 2 (inclusive) with an increment of 0.2 and 157print the results with two digits after the decimal point (using a 158.Xr printf 3 159style format): 160.Bd -literal -offset indent 161$ seq -f %.2f 1 0.2 2 1621.00 1631.20 1641.40 1651.60 1661.80 1672.00 168.Ed 169.Sh SEE ALSO 170.Xr jot 1 , 171.Xr printf 1 , 172.Xr printf 3 173.Sh HISTORY 174A 175.Nm 176command appeared in 177Version\~8 178.At . 179This version of 180.Nm 181appeared in 182.Nx 3.0 183and was ported to 184.Ox 7.1 . 185.Sh BUGS 186The 187.Fl w 188option does not handle the transition from pure floating point 189to exponent representation very well. 190The 191.Nm 192utility is not bug for bug compatible with other implementations. 193