The SEQ command is used to print numbers to the mantissa starting with the specified increment, that is, to produce all integers from one number to another, and to control the format, width, and split symbol of an integer.
Grammar:
[1] seq [option] Mantissa
[2] SEQ [options] The mantissa of the first number
[3] SEQ [option] The first increment of the mantissa
Options:
-F,--format= format using printf-style floating-point format
-S, the--separator= string separates numbers using the specified string (by default: \ n)
-W,--equal-width add 0 before column to make the same width
Ex1, Syntax examples
[Zhangqi@localhost shellscript]$ seq 5
1
2
3
4
5
[zhangqi@localhost shellscript]$ seq 1 5
1
2
3
4
5
[zhangqi@localhost shellscript]$ seq 1
2 5 1 3 5 [ Zhangqi@localhost shellscript]$
As you can see from the example above, when the first number of SEQ is empty, the default is 1
EX2, F option Example
[Zhangqi@localhost shellscript]$ seq-f "%2g" 9/
9
[zhangqi@localhost shellscript]$ seq-f "%3g" 9
(9
)
[zhangqi@localhost shellscript]$ seq-f "%03g" 9
/009 010 011 [ Zhangqi@localhost shellscript]$ seq-f "str%03g" 9
str009 str010
str011
The example above shows the number of digits after%, the default is%g,%3g so that the number of digits is not enough is a space, the symbol before the number represents the padding bit.
EX3, S option sample
[Zhangqi@localhost shellscript]$ Seq-s ":" F "str%03g" 9
str009:str010:str011
Between the characters of the output ":" Interval
EX4, W option example
[Zhangqi@localhost shellscript]$ seq-w 9
[zhangqi@localhost shellscript]$ seq-f "%2g"-W 9 1 1
Seq:format string May is specified when printing equal the width strings
Try ' seq--help ' for more information.
[Zhangqi@localhost shellscript]$
As you can see from the example above, the numbers for the W option output are equal widths, and W and F cannot be used at the same time.