The seq command is used to print numbers from the leading number to the mantissa in a specified increment, that is, to generate all integers from a certain number to another number, and to control the format, width, and division symbols of the integers
grammar:
[1] seq [options] mantissa
[2] seq [options] leading number mantissa
[3] seq [options] prefix increment mantissa
Options:
-f, --format=format
-s, --separator=string, use the specified string to split the numbers (by default a "\n" is used)
-w, --sequal-width prepend 0 to columns to make the same width
Example:
[1] Generate integers up to 5
Command: seq 5
output:
[2] Generate integers from -2 to 10 in increments of 2
Command: seq -2 2 10
output:
[3] Generate integers between 98 and 101, and require the output numbers to have the same width, and fill in the missing ones with spaces.
命令: seq -f "%3g" 98 101
output:
Command: seq -f "%03g" 98 101
output:
Note: Fill the gap by adding 0 after % to replace the space
[4] Produces an integer between 98 and 101, and requires the separator between numbers to be ":::".
命令:seq -s ":::" -f "%03g" 98 101
output:
[5] Output an integer between 98 and 100, requiring the same width
Command: seq -w 98 101
output:
Note: the -w option cannot be used with the -f option, the output is the same width