[BACK]Return to seq.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / seq

Annotation of src/usr.bin/seq/seq.1, Revision 1.4

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