xref: /freebsd/usr.bin/seq/seq.1 (revision 2f893597fcc34456d5adfc3f1633b39c76d0764f)
1*2f893597SAlexander Ziaee.\"
2*2f893597SAlexander Ziaee.\" SPDX-License-Identifier: BSD-2-Clause
3*2f893597SAlexander Ziaee.\"
4bf855dd3SXin LI.\"	$NetBSD: seq.1,v 1.8 2013/04/07 17:37:45 jdf Exp $
5208987a5SXin LI.\"
6208987a5SXin LI.\" Copyright (c) 2005 The NetBSD Foundation, Inc.
7208987a5SXin LI.\" All rights reserved.
8208987a5SXin LI.\"
9208987a5SXin LI.\" This code is derived from software contributed to The NetBSD Foundation
10208987a5SXin LI.\" by Brian Ginsbach.
11208987a5SXin LI.\"
12208987a5SXin LI.\" Redistribution and use in source and binary forms, with or without
13208987a5SXin LI.\" modification, are permitted provided that the following conditions
14208987a5SXin LI.\" are met:
15208987a5SXin LI.\" 1. Redistributions of source code must retain the above copyright
16208987a5SXin LI.\"    notice, this list of conditions and the following disclaimer.
17208987a5SXin LI.\" 2. Redistributions in binary form must reproduce the above copyright
18208987a5SXin LI.\"    notice, this list of conditions and the following disclaimer in the
19208987a5SXin LI.\"    documentation and/or other materials provided with the distribution.
20208987a5SXin LI.\"
21208987a5SXin LI.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22208987a5SXin LI.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23208987a5SXin LI.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24208987a5SXin LI.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25208987a5SXin LI.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26208987a5SXin LI.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27208987a5SXin LI.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28208987a5SXin LI.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29208987a5SXin LI.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30208987a5SXin LI.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31208987a5SXin LI.\" POSSIBILITY OF SUCH DAMAGE.
32208987a5SXin LI.\"
33f3ec6af0SFernando Apesteguía.Dd June 20, 2020
34208987a5SXin LI.Dt SEQ 1
35208987a5SXin LI.Os
36208987a5SXin LI.Sh NAME
37208987a5SXin LI.Nm seq
38208987a5SXin LI.Nd print sequences of numbers
39208987a5SXin LI.Sh SYNOPSIS
40208987a5SXin LI.Nm
41208987a5SXin LI.Op Fl w
42208987a5SXin LI.Op Fl f Ar format
43208987a5SXin LI.Op Fl s Ar string
44208987a5SXin LI.Op Fl t Ar string
45208987a5SXin LI.Op Ar first Op Ar incr
46208987a5SXin LI.Ar last
47208987a5SXin LI.Sh DESCRIPTION
48208987a5SXin LIThe
49208987a5SXin LI.Nm
50208987a5SXin LIutility prints a sequence of numbers, one per line
51208987a5SXin LI.Pq default ,
52208987a5SXin LIfrom
53208987a5SXin LI.Ar first
54208987a5SXin LI.Pq default 1 ,
55208987a5SXin LIto near
56208987a5SXin LI.Ar last
57208987a5SXin LIas possible, in increments of
58208987a5SXin LI.Ar incr
59208987a5SXin LI.Pq default 1 .
60208987a5SXin LIWhen
61208987a5SXin LI.Ar first
62208987a5SXin LIis larger than
63bf855dd3SXin LI.Ar last ,
64208987a5SXin LIthe default
65208987a5SXin LI.Ar incr
66208987a5SXin LIis -1.
67208987a5SXin LI.Pp
68208987a5SXin LIAll numbers are interpreted as floating point.
69208987a5SXin LI.Pp
70208987a5SXin LINormally integer values are printed as decimal integers.
71208987a5SXin LI.Pp
72208987a5SXin LIThe
73208987a5SXin LI.Nm
74208987a5SXin LIutility accepts the following options:
75*2f893597SAlexander Ziaee.Bl -tag -width indent
76a3f2c2feSKyle Evans.It Fl f Ar format , Fl -format Ar format
77208987a5SXin LIUse a
78208987a5SXin LI.Xr printf 3
79208987a5SXin LIstyle
80208987a5SXin LI.Ar format
81208987a5SXin LIto print each number.
82208987a5SXin LIOnly the
83bf855dd3SXin LI.Cm A ,
84bf855dd3SXin LI.Cm a ,
85208987a5SXin LI.Cm E ,
86208987a5SXin LI.Cm e ,
87bf855dd3SXin LI.Cm F ,
88208987a5SXin LI.Cm f ,
89208987a5SXin LI.Cm G ,
90208987a5SXin LI.Cm g ,
91208987a5SXin LIand
92208987a5SXin LI.Cm %
93208987a5SXin LIconversion characters are valid, along with any optional
94208987a5SXin LIflags and an optional numeric minimum field width or precision.
95208987a5SXin LIThe
96208987a5SXin LI.Ar format
97208987a5SXin LIcan contain character escape sequences in backslash notation as
98208987a5SXin LIdefined in
99208987a5SXin LI.St -ansiC .
100208987a5SXin LIThe default is
101208987a5SXin LI.Cm %g .
102a3f2c2feSKyle Evans.It Fl s Ar string , Fl -separator Ar string
103208987a5SXin LIUse
104208987a5SXin LI.Ar string
105208987a5SXin LIto separate numbers.
106208987a5SXin LIThe
107208987a5SXin LI.Ar string
108208987a5SXin LIcan contain character escape sequences in backslash notation as
109208987a5SXin LIdefined in
110208987a5SXin LI.St -ansiC .
111208987a5SXin LIThe default is
112208987a5SXin LI.Cm \en .
113a3f2c2feSKyle Evans.It Fl t Ar string , Fl -terminator Ar string
114208987a5SXin LIUse
115208987a5SXin LI.Ar string
116208987a5SXin LIto terminate sequence of numbers.
117208987a5SXin LIThe
118208987a5SXin LI.Ar string
119208987a5SXin LIcan contain character escape sequences in backslash notation as
120208987a5SXin LIdefined in
121208987a5SXin LI.St -ansiC .
122208987a5SXin LIThis option is useful when the default separator
123208987a5SXin LIdoes not contain a
124208987a5SXin LI.Cm \en .
125a3f2c2feSKyle Evans.It Fl w , Fl -fixed-width
126208987a5SXin LIEqualize the widths of all numbers by padding with zeros as necessary.
127208987a5SXin LIThis option has no effect with the
128208987a5SXin LI.Fl f
129208987a5SXin LIoption.
130208987a5SXin LIIf any sequence numbers will be printed in exponential notation,
131208987a5SXin LIthe default conversion is changed to
132208987a5SXin LI.Cm %e .
133208987a5SXin LI.El
134ed120cdbSEitan Adler.Sh EXIT STATUS
135ed120cdbSEitan Adler.Ex -std
136208987a5SXin LI.Sh EXAMPLES
137f3ec6af0SFernando ApesteguíaGenerate a sequence from 1 to 3 (included) with a default increment of 1:
138208987a5SXin LI.Bd -literal -offset indent
139208987a5SXin LI# seq 1 3
140208987a5SXin LI1
141208987a5SXin LI2
142208987a5SXin LI3
143f3ec6af0SFernando Apesteguía.Ed
144f3ec6af0SFernando Apesteguía.Pp
145f3ec6af0SFernando ApesteguíaGenerate a sequence from 3 to 1 (included) with a default increment of -1:
146f3ec6af0SFernando Apesteguía.Bd -literal -offset indent
147208987a5SXin LI# seq 3 1
148208987a5SXin LI3
149208987a5SXin LI2
150208987a5SXin LI1
151f3ec6af0SFernando Apesteguía.Ed
152f3ec6af0SFernando Apesteguía.Pp
153f3ec6af0SFernando ApesteguíaGenerate a sequence from 0 to 0.1 (included) with an increment of 0.05 and padding
154f3ec6af0SFernando Apesteguíawith leading zeroes.
155f3ec6af0SFernando Apesteguía.Bd -literal -offset indent
156208987a5SXin LI# seq -w 0 .05 .1
157208987a5SXin LI0.00
158208987a5SXin LI0.05
159208987a5SXin LI0.10
160208987a5SXin LI.Ed
161f3ec6af0SFernando Apesteguía.Pp
162f3ec6af0SFernando ApesteguíaGenerate a sequence from 1 to 3 (included) with a default increment of 1,
163f3ec6af0SFernando Apesteguíaa custom separator string and a custom terminator:
164f3ec6af0SFernando Apesteguía.Bd -literal -offset indent
165f3ec6af0SFernando Apesteguía# seq -s "-->" -t "[end of list]\\n" 1 3
166f3ec6af0SFernando Apesteguía1-->2-->3-->[end of list]
167f3ec6af0SFernando Apesteguía.Ed
168f3ec6af0SFernando Apesteguía.Pp
169f3ec6af0SFernando ApesteguíaGenerate a sequence from 1 to 2 (included) with an increment of 0.2 and
170f3ec6af0SFernando Apesteguíaprint the results with two digits after the decimal point (using a
171f3ec6af0SFernando Apesteguía.Xr printf 3
172f3ec6af0SFernando Apesteguíastyle format):
173f3ec6af0SFernando Apesteguía.Bd -literal -offset indent
174f3ec6af0SFernando Apesteguía# seq -f %.2f 1 0.2 2
175f3ec6af0SFernando Apesteguía1.00
176f3ec6af0SFernando Apesteguía1.20
177f3ec6af0SFernando Apesteguía1.40
178f3ec6af0SFernando Apesteguía1.60
179f3ec6af0SFernando Apesteguía1.80
180f3ec6af0SFernando Apesteguía2.00
181f3ec6af0SFernando Apesteguía.Ed
182208987a5SXin LI.Sh SEE ALSO
183208987a5SXin LI.Xr jot 1 ,
184208987a5SXin LI.Xr printf 1 ,
185208987a5SXin LI.Xr printf 3
186208987a5SXin LI.Sh HISTORY
187208987a5SXin LIThe
188208987a5SXin LI.Nm
189a63166d8SWarren Blockcommand first appeared in Version\~8
190a63166d8SWarren Block.At .
191208987a5SXin LIA
192208987a5SXin LI.Nm
193208987a5SXin LIcommand appeared in
194208987a5SXin LI.Nx 3.0 ,
195a63166d8SWarren Blockand was ported to
196208987a5SXin LI.Fx 9.0 .
197208987a5SXin LIThis command was based on the command of the same name in
198f3ec6af0SFernando ApesteguíaPlan 9 from Bell Labs and the GNU core utilities.
199f3ec6af0SFernando ApesteguíaThe GNU
200208987a5SXin LI.Nm
201208987a5SXin LIcommand first appeared in the 1.13 shell utilities release.
202208987a5SXin LI.Sh BUGS
203208987a5SXin LIThe
204208987a5SXin LI.Fl w
205208987a5SXin LIoption does not handle the transition from pure floating point
206208987a5SXin LIto exponent representation very well.
207208987a5SXin LIThe
208208987a5SXin LI.Nm
209a63166d8SWarren Blockcommand is not bug for bug compatible with other implementations.
210