seq

Print a sequence of numbers to standard output

Syntax
      seq [options]... [FIRST [STEP]] LAST...

Options

 -f FORMAT
 --format=FORMAT
     Print all numbers using FORMAT; default '%g'.  FORMAT must contain
     exactly one of the standarding float output formats '%e', '%f', or
     '%g'.

 -s STRING
 --separator=STRING
     Separate numbers with STRING; default is a newline.  The output
     always terminates with a newline.

 -w
 --equal-width
     Print all numbers with the same width, by padding with leading
     zeroes.  (To have other kinds of padding, use '--format').

'seq' prints the numbers from FIRST to LAST by STEP.

By default, FIRST and STEP are both 1, and each number is printed on its own line. All numbers can be reals, not just integers.

Examples

Produce a sequence of numbers from 1 to 100

$ seq 100

You can also produce a sequence with the for command

for ((myseq=0; myseq<50; myseq++))
do
echo The sequence is ${myseq}
done
fi

“The idea of a Being who interferes with the sequence of events in the world is absolutely impossible” ~ Albert Einstein

Related Linux commands

expr - Evaluate expressions.
for - Expand words, and execute commands
nl - Number lines and write files.
Equivalent Windows commands: FOR /L - Numeric loop.


 
Copyright © 1999-2024 SS64.com
Some rights reserved