xref: /minix/usr.bin/seq/seq.1 (revision ebfedea0)
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.\"
31.Dd May 27, 2010
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 .
120This option is useful when the default separator
121does not contain a
122.Cm \en .
123.It Fl w
124Equalize the widths of all numbers by padding with zeros as necessary.
125This option has no effect with the
126.Fl f
127option.
128If any sequence numbers will be printed in exponential notation,
129the default conversion is changed to
130.Cm %e .
131.El
132.Sh EXIT STATUS
133.Ex -std
134.Sh EXAMPLES
135.Bd -literal -offset indent
136# seq 1 3
1371
1382
1393
140
141# seq 3 1
1423
1432
1441
145
146# seq -w 0 .05 .1
1470.00
1480.05
1490.10
150.Ed
151.Sh SEE ALSO
152.Xr jot 1 ,
153.Xr printf 1 ,
154.Xr printf 3
155.Sh HISTORY
156The
157.Nm
158command first appeared in
159.Tn "Plan 9 from Bell Labs" .
160A
161.Nm
162command appeared in
163.Nx 3.0 .
164This command was based on the command of the same name in
165.Tn "Plan 9 from Bell Labs"
166and the
167.Tn GNU
168core utilities.
169The
170.Tn GNU
171.Nm
172command first appeared in the 1.13 shell utilities release.
173.Sh BUGS
174The
175.Fl w
176option does not handle the transition from pure floating point
177to exponent representation very well.
178The
179.Nm
180command is not bug for bug compatible with the
181.Tn "Plan 9 from Bell Labs"
182or
183.Tn GNU
184versions of
185.Nm .
186