码迷,mamicode.com
首页 > 其他好文 > 详细

命令之乐--seq

时间:2016-08-06 23:23:01      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

用法及参数:
  -f, --format=格式          使用printf 样式的浮点格式,默认是g%
  -s, --separator=字符串      使用指定字符串分隔数字(默认使用:\n)
  -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

 

命令之乐--seq

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!