1.\" $NetBSD: seq.1,v 1.8 2013/04/07 17:37:45 jdf 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.\" $FreeBSD$ 31.\" 32.Dd June 20, 2020 33.Dt SEQ 1 34.Os 35.Sh NAME 36.Nm seq 37.Nd print sequences of numbers 38.Sh SYNOPSIS 39.Nm 40.Op Fl w 41.Op Fl f Ar format 42.Op Fl s Ar string 43.Op Fl t Ar string 44.Op Ar first Op Ar incr 45.Ar last 46.Sh DESCRIPTION 47The 48.Nm 49utility prints a sequence of numbers, one per line 50.Pq default , 51from 52.Ar first 53.Pq default 1 , 54to near 55.Ar last 56as possible, in increments of 57.Ar incr 58.Pq default 1 . 59When 60.Ar first 61is larger than 62.Ar last , 63the default 64.Ar incr 65is -1. 66.Pp 67All numbers are interpreted as floating point. 68.Pp 69Normally integer values are printed as decimal integers. 70.Pp 71The 72.Nm 73utility accepts the following options: 74.Bl -tag -width Ar 75.It Fl f Ar format , Fl -format Ar format 76Use a 77.Xr printf 3 78style 79.Ar format 80to print each number. 81Only the 82.Cm A , 83.Cm a , 84.Cm E , 85.Cm e , 86.Cm F , 87.Cm f , 88.Cm G , 89.Cm g , 90and 91.Cm % 92conversion characters are valid, along with any optional 93flags and an optional numeric minimum field width or precision. 94The 95.Ar format 96can contain character escape sequences in backslash notation as 97defined in 98.St -ansiC . 99The default is 100.Cm %g . 101.It Fl s Ar string , Fl -separator Ar string 102Use 103.Ar string 104to separate numbers. 105The 106.Ar string 107can contain character escape sequences in backslash notation as 108defined in 109.St -ansiC . 110The default is 111.Cm \en . 112.It Fl t Ar string , Fl -terminator Ar string 113Use 114.Ar string 115to terminate sequence of numbers. 116The 117.Ar string 118can contain character escape sequences in backslash notation as 119defined in 120.St -ansiC . 121This option is useful when the default separator 122does not contain a 123.Cm \en . 124.It Fl w , Fl -fixed-width 125Equalize the widths of all numbers by padding with zeros as necessary. 126This option has no effect with the 127.Fl f 128option. 129If any sequence numbers will be printed in exponential notation, 130the default conversion is changed to 131.Cm %e . 132.El 133.Sh EXIT STATUS 134.Ex -std 135.Sh EXAMPLES 136Generate a sequence from 1 to 3 (included) with a default increment of 1: 137.Bd -literal -offset indent 138# seq 1 3 1391 1402 1413 142.Ed 143.Pp 144Generate a sequence from 3 to 1 (included) with a default increment of -1: 145.Bd -literal -offset indent 146# seq 3 1 1473 1482 1491 150.Ed 151.Pp 152Generate a sequence from 0 to 0.1 (included) with an increment of 0.05 and padding 153with leading zeroes. 154.Bd -literal -offset indent 155# seq -w 0 .05 .1 1560.00 1570.05 1580.10 159.Ed 160.Pp 161Generate a sequence from 1 to 3 (included) with a default increment of 1, 162a custom separator string and a custom terminator: 163.Bd -literal -offset indent 164# seq -s "-->" -t "[end of list]\\n" 1 3 1651-->2-->3-->[end of list] 166.Ed 167.Pp 168Generate a sequence from 1 to 2 (included) with an increment of 0.2 and 169print the results with two digits after the decimal point (using a 170.Xr printf 3 171style format): 172.Bd -literal -offset indent 173# seq -f %.2f 1 0.2 2 1741.00 1751.20 1761.40 1771.60 1781.80 1792.00 180.Ed 181.Sh SEE ALSO 182.Xr jot 1 , 183.Xr printf 1 , 184.Xr printf 3 185.Sh HISTORY 186The 187.Nm 188command first appeared in Version\~8 189.At . 190A 191.Nm 192command appeared in 193.Nx 3.0 , 194and was ported to 195.Fx 9.0 . 196This command was based on the command of the same name in 197Plan 9 from Bell Labs and the GNU core utilities. 198The GNU 199.Nm 200command first appeared in the 1.13 shell utilities release. 201.Sh BUGS 202The 203.Fl w 204option does not handle the transition from pure floating point 205to exponent representation very well. 206The 207.Nm 208command is not bug for bug compatible with other implementations. 209