xref: /netbsd-src/usr.bin/seq/seq.1 (revision e77448e07be3174235c13f58032a0d6d0ab7638d)
1.\"	$NetBSD: seq.1,v 1.5 2008/04/30 14:22:14 ginsbach 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 January 17, 2005
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.  Only the
80.Cm E ,
81.Cm e ,
82.Cm f ,
83.Cm G ,
84.Cm g ,
85and
86.Cm %
87conversion characters are valid, along with any optional
88flags and an optional numeric mimimum field width or precision.
89The
90.Ar format
91can contain character escape sequences in backslash notation as
92defined in
93.St -ansiC .
94The default is
95.Cm %g .
96.It Fl s Ar string
97Use
98.Ar string
99to separate numbers.
100The
101.Ar string
102can contain character escape sequences in backslash notation as
103defined in
104.St -ansiC .
105The default is
106.Cm \en .
107.It Fl t Ar string
108Use
109.Ar string
110to terminate sequence of numbers.
111The
112.Ar string
113can contain character escape sequences in backslash notation as
114defined in
115.St -ansiC .
116This option is useful when the default separator
117does not contain a
118.Cm \en .
119.It Fl w
120Equalize the widths of all numbers by padding with zeros as necessary.
121This option has no effect with the
122.Fl f
123option.
124If any sequence numbers will be printed in exponential notation,
125the default conversion is changed to
126.Cm %e .
127.El
128.Pp
129The
130.Nm
131utility exits 0 on success and non-zero if an error occurs.
132.Sh EXAMPLES
133.Bd -literal -offset indent
134# seq 1 3
1351
1362
1373
138
139# seq 3 1
1403
1412
1421
143
144# seq -w 0 .05 .1
1450.00
1460.05
1470.10
148.Ed
149.Sh SEE ALSO
150.Xr jot 1 ,
151.Xr printf 1 ,
152.Xr printf 3
153.Sh HISTORY
154The
155.Nm
156command first appeared in
157.Tn "Plan 9 from Bell Labs" .
158A
159.Nm
160command appeared in
161.Nx 3.0 .
162This command was based on the command of the same name in
163.Tn "Plan 9 from Bell Labs"
164and the
165.Tn GNU
166core utilities.
167The
168.Tn GNU
169.Nm
170command first appeared in the 1.13 shell utilities release.
171.Sh BUGS
172The
173.Fl w
174option does not handle the transition from pure floating point
175to exponent representation very well.
176The
177.Nm
178command is not bug for bug compatible with the
179.Tn "Plan 9 from Bell Labs"
180or
181.Tn GNU
182versions of
183.Nm .
184