Linux命令之乐--seq

用法及参数:
  -f, --format=格式          使用printf 样式的浮点格式,默认是g%
  -s, --separator=字符串      使用指定字符串分隔数字(默认使用: )
  -w, --equal-width         在列前添加0 使得宽度相同

-f,指定打印格式

seq默认的格式输出是g%,如果省略了首数,则默认从1开始

[root@Director test]# seq 3
1
2
3

指定整型宽度

[root@Director test]# seq -f %03g 3
001
002
003

指定浮点数

[root@Director test]# seq -f %0.3f 3
1.000
2.000
3.000

-w,使输出数字同宽

[root@Director test]# seq -w 5
1
2
3
...
[root@Director test]# seq -w 10
01
02
03
... [root@Director test]# seq -w 100 001 002
003
.....

-s ,指定分隔符,默认是换行

[root@Director test]# seq -s " " 0 5
0 1 2 3 4 5
[root@Director test]# seq -s , 0 5
0,1,2,3,4,5
[root@Director test]# seq -s | 0 5
0|1|2|3|4|5
[root@Director ~]# seq -s "+" 10|bc
55

seq的逆序输出

原文地址:https://www.cnblogs.com/zydev/p/5745095.html