1、簡單用法,直接加數字
[root@linuxprobe test]# seq 10 ## 輸出1到10列表 1
2
3
4
5
6
7
8
9
10
2、設置起點、終點
[root@linuxprobe test]# seq 5 10 ##設置起點為5,終點為10,默認的步長為1。
5
6
7
8
9
10
3、設置步長
[root@linuxprobe test]# seq 1 2 10 ##步長為2
1
3
5
7
9 [root@linuxprobe test]# seq 1 3 10 ##步長為3
1
4
7
10
4、-w 設置輸出數字同寬
[root@linuxprobe test]# seq 10
1
2
3
4
5
6
7
8
9
10 [root@linuxprobe test]# seq -w 10 ##設置同寬
01
02
03
04
05
06
07
08
09
10 [root@linuxprobe test]# seq -w 100 | tail ##同上 091
092
093
094
095
096
097
098
099
100
5、指定數字寬度
[root@linuxprobe test]# seq -f %2g 10 ##指定寬度為2
1
2
3
4
5
6
7
8
9
10 [root@linuxprobe test]# seq -f %3g 10 ## 指定寬度為3
1
2
3
4
5
6
7
8
9
10
6、用0填充多余間隔
[root@linuxprobe test]# seq -f %02g 10
01
02
03
04
05
06
07
08
09
10 [root@linuxprobe test]# seq -f %03g 10
001
002
003
004
005
006
007
008
009
010
7、添加指定字符
[root@linuxprobe test]# seq -f xxx%02g 10 xxx01 xxx02 xxx03 xxx04 xxx05 xxx06 xxx07 xxx08 xxx09 xxx10 [root@linuxprobe test]# seq -f xxx%02gyyy 10 xxx01yyy xxx02yyy xxx03yyy xxx04yyy xxx05yyy xxx06yyy xxx07yyy xxx08yyy xxx09yyy xxx10yyy
8、-s 選項用於指定輸出分割符
[root@linuxprobe test]# seq -s " " 6 ## 以空格為分隔符
1 2 3 4 5 6 [root@linuxprobe test]# seq -s "--" 6 ## 以--為分隔符
1--2--3--4--5--6 [root@linuxprobe test]# seq -s ":" 6 ## 以:為分隔符
1:2:3:4:5:6