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