Seq Command Introduction
Use:
Seq-print a sequence of numbers
Grammar:
seq [OPTION] ... Last
seq [OPTION] ... First Last
seq [OPTION] ... First INCREMENT Last
Common options
-S,--separator=string
Use STRING to separate numbers (default: \ n)
-W,--equal-width
Equalize width by padding with leading zeroes
1 Default Printing 1-10
[[email protected] ~]# seq 1 512345
2 Printing 5-1
[[email protected] ~]# seq 5-1 154321
3 Printing 1 2 3 4 5
[[email protected] ~]# seq-s ' 1 51 2 3 4 5
Or
[[email protected] ~]# SEQ 1 5 | Tr ' \ n ' ' 1 2 3 4 5 [[email protected] ~]#
4 Printing 01 02 03 04 05 06 07 08 09 10
[[email protected] ~]# seq-s '-W 1 1001 02 03 04 05 06 07 08 09 10
Or
[[email protected] ~]# echo {01..10}01 02 03 04 05 06 07 08 09 10
Commonly used in a for loop
[[email protected] ~]# for i in {1..10};d o echo $i;d one12345678910[[email protected] ~]# for I in ' seq-w-S ' 1 10 '; Do echo $i;d one01020304050607080910
This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1766440
How the shell generates a sequence 01 02 03 04 05