Name
seq — stdin stdout - file -- opt --help --version
Synopsis
seq [options]specification
The seq command prints a
sequence of integers or real numbers, suitable for piping to other
programs. There are three kinds of specification
arguments:
- A single number: an upper limit
seqbegins at 1 and counts up to the number.$ seq 3 1 2 3
- Two numbers: lower and upper limit
seqbegins at the first number and counts as far as it can without passing the second number.$ seq 2 5 2 3 4 5
- Three numbers: lower limit, increment, and upper limit
seqbegins at the first number, increments by the second number, and stops at (or before) the third number.$ seq 1 .3 2 1 1.3 1.6 1.9
You can also go backward with a negative increment:
$ seq 5 -1 2 5 4 3 2
Useful options
|
| Print leading zeroes, as necessary, to give all lines the same width: $ seq -w 8 10 08 09 10 |
|
| Format the output
lines with a $ seq -f '**%g**' 3 **1** **2** **3** |
|
| Use the given string as a separator between the numbers. By default, a newline is printed (i.e., one number per line): $ seq -s ':' 10 1:2:3:4:5:6:7:8:9:10 |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access