xref: /netbsd-src/usr.bin/seq/seq.1 (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1.\"	$NetBSD: seq.1,v 1.10 2018/12/17 20:10:51 christos 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
49.Pq default ,
50from
51.Ar first
52.Pq default 1 ,
53to near
54.Ar last
55as possible, in increments of
56.Ar incr
57.Pq default 1 .
58When
59.Ar first
60is larger than
61.Ar last ,
62the default
63.Ar incr
64is -1.
65.Pp
66All numbers are interpreted as floating point.
67.Pp
68Normally integer values are printed as decimal integers.
69.Pp
70The
71.Nm
72utility accepts the following options:
73.Bl -tag -width Ar
74.It Fl f Ar format
75Use a
76.Xr printf 3
77style
78.Ar format
79to print each number.
80Only the
81.Cm A ,
82.Cm a ,
83.Cm E ,
84.Cm e ,
85.Cm F ,
86.Cm f ,
87.Cm G ,
88.Cm g ,
89and
90.Cm %
91conversion characters are valid, along with any optional
92flags and an optional numeric mimimum field width or precision.
93The
94.Ar format
95can contain character escape sequences in backslash notation as
96defined in
97.St -ansiC .
98The default is
99.Cm %g .
100.It Fl s Ar string
101Use
102.Ar string
103to separate numbers.
104The
105.Ar string
106can contain character escape sequences in backslash notation as
107defined in
108.St -ansiC .
109The default is
110.Cm \en .
111.It Fl t Ar string
112Use
113.Ar string
114to terminate sequence of numbers.
115The
116.Ar string
117can contain character escape sequences in backslash notation as
118defined in
119.St -ansiC .
120The default is
121.Cm \en .
122.It Fl w
123Equalize the widths of all numbers by padding with zeros as necessary.
124This option has no effect with the
125.Fl f
126option.
127If any sequence numbers will be printed in exponential notation,
128the default conversion is changed to
129.Cm %e .
130.El
131.Sh EXIT STATUS
132.Ex -std
133.Sh EXAMPLES
134.Bd -literal -offset indent
135# seq 1 3
1361
1372
1383
139
140# seq 3 1
1413
1422
1431
144
145# seq -w 0 .05 .1
1460.00
1470.05
1480.10
149.Ed
150.Sh SEE ALSO
151.Xr jot 1 ,
152.Xr printf 1 ,
153.Xr printf 3
154.Sh HISTORY
155The
156.Nm
157command first appeared in Version\~8
158.At .
159A
160.Nm
161command appeared in
162.Nx 3.0 .
163This command was based on the command of the same name in
164.Tn "Plan 9 from Bell Labs"
165and the
166.Tn GNU
167core utilities.
168The
169.Tn GNU
170.Nm
171command first appeared in the 1.13 shell utilities release.
172.Sh BUGS
173The
174.Fl w
175option does not handle the transition from pure floating point
176to exponent representation very well.
177The
178.Nm
179command is not bug for bug compatible with other implementations.
180