coreutils: seq invocation

1 
1 26.3 ‘seq’: Print numeric sequences
1 ===================================
1 
1 ‘seq’ prints a sequence of numbers to standard output.  Synopses:
1 
1      seq [OPTION]... LAST
1      seq [OPTION]... FIRST LAST
1      seq [OPTION]... FIRST INCREMENT LAST
1 
1    ‘seq’ prints the numbers from FIRST to LAST by INCREMENT.  By
1 default, each number is printed on a separate line.  When INCREMENT is
1 not specified, it defaults to ‘1’, even when FIRST is larger than LAST.
1 FIRST also defaults to ‘1’.  So ‘seq 1’ prints ‘1’, but ‘seq 0’ and ‘seq
1 10 5’ produce no output.  The sequence of numbers ends when the sum of
1 the current number and INCREMENT would become greater than LAST, so ‘seq
1 1 10 10’ only produces ‘1’.  INCREMENT must not be ‘0’; use ‘yes’ to get
1 repeated output of a constant number.  FIRST, INCREMENT and LAST must
11 not be ‘NaN’.  Floating-point numbers may be specified.  ⇒Floating
 point.
1 
11    The program accepts the following options.  Also see ⇒Common
 options.  Options must precede operands.
1 
1 ‘-f FORMAT’
1 ‘--format=FORMAT’
1      Print all numbers using FORMAT.  FORMAT must contain exactly one of
1      the ‘printf’-style floating point conversion specifications ‘%a’,
1      ‘%e’, ‘%f’, ‘%g’, ‘%A’, ‘%E’, ‘%F’, ‘%G’.  The ‘%’ may be followed
1      by zero or more flags taken from the set ‘-+#0 '’, then an optional
1      width containing one or more digits, then an optional precision
1      consisting of a ‘.’ followed by zero or more digits.  FORMAT may
1      also contain any number of ‘%%’ conversion specifications.  All
1      conversion specifications have the same meaning as with ‘printf’.
1 
1      The default format is derived from FIRST, STEP, and LAST.  If these
1      all use a fixed point decimal representation, the default format is
1      ‘%.Pf’, where P is the minimum precision that can represent the
1      output numbers exactly.  Otherwise, the default format is ‘%g’.
1 
1 ‘-s STRING’
1 ‘--separator=STRING’
1      Separate numbers with STRING; default is a newline.  The output
1      always terminates with a newline.
1 
1 ‘-w’
1 ‘--equal-width’
1      Print all numbers with the same width, by padding with leading
1      zeros.  FIRST, STEP, and LAST should all use a fixed point decimal
1      representation.  (To have other kinds of padding, use ‘--format’).
1 
1    You can get finer-grained control over output with ‘-f’:
1 
1      $ seq -f '(%9.2E)' -9e5 1.1e6 1.3e6
1      (-9.00E+05)
1      ( 2.00E+05)
1      ( 1.30E+06)
1 
1    If you want hexadecimal integer output, you can use ‘printf’ to
1 perform the conversion:
1 
1      $ printf '%x\n' $(seq 1048575 1024 1050623)
1      fffff
1      1003ff
1      1007ff
1 
1    For very long lists of numbers, use xargs to avoid system limitations
1 on the length of an argument list:
1 
1      $ seq 1000000 | xargs printf '%x\n' | tail -n 3
1      f423e
1      f423f
1      f4240
1 
1    To generate octal output, use the printf ‘%o’ format instead of ‘%x’.
1 
1    On most systems, seq can produce whole-number output for values up to
1 at least 2^{53}.  Larger integers are approximated.  The details differ
11 depending on your floating-point implementation.  ⇒Floating
 point.  A common case is that ‘seq’ works with integers through
1 2^{64}, and larger integers may not be numerically correct:
1 
1      $ seq 50000000000000000000 2 50000000000000000004
1      50000000000000000000
1      50000000000000000000
1      50000000000000000004
1 
1    However, note that when limited to non-negative whole numbers, an
1 increment of 1 and no format-specifying option, seq can print
1 arbitrarily large numbers.
1 
1    Be careful when using ‘seq’ with outlandish values: otherwise you may
1 see surprising results, as ‘seq’ uses floating point internally.  For
1 example, on the x86 platform, where the internal representation uses a
1 64-bit fraction, the command:
1 
1      seq 1 0.0000000000000000001 1.0000000000000000009
1 
1    outputs 1.0000000000000000007 twice and skips 1.0000000000000000008.
1 
1    An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1