seq的一些用法示例

简介:

seq的一些用法示例

参考:http://oldboy.blog.51cto.com/2561410/1216107

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[root@test200 ~] # seq -s " " -w 20
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
[root@test200 ~]
[root@test200 ~] # seq -w 20 |tr "\n" " "
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@test200 ~]
[root@test200 ~]
[root@test200 ~] # echo {0..20} 
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
[root@test200 ~]
[root@test200 ~] # echo `seq -w 10` {11..20}
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
[root@test200 ~]
[root@test200 ~] # printf "%02d " $(echo {0..20})
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@test200 ~]
[root@test200 ~]
[root@test200 ~] # seq -s " " -f "%02g" 20
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
[root@test200 ~]
[root@test200 ~] # seq -f "%02g" 20 |xargs -n 20
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20
[root@test200 ~]
[root@test200 ~] # for i in `seq -w 20`;do echo -n $i" "; done
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@test200 ~]
[root@test200 ~]
[root@test200 ~] # for i in `seq 20`;do printf "%02d " $i; done   
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@test200 ~]
[root@test200 ~]
[root@test200 ~] # seq 20 |awk '{if (NR<10) printf '0'$0" ";else printf $1" "}'
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@test200 ~]
[root@test200 ~]
[root@test200 ~] # seq 20 |sed 's/\(^[0-9]\)$/0\1/g' |tr "\n" " "
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@test200 ~]
[root@test200 ~] #



本文转自 pcnk 51CTO博客,原文链接:http://blog.51cto.com/nosmoking/1659789,如需转载请自行联系原作者
相关文章
|
4月前
|
自然语言处理 Java Maven
word分词--实例---用法
word分词--实例---用法
30 2
|
5月前
|
存储 分布式计算 Apache
Spark编程范例:Word Count示例解析
Spark编程范例:Word Count示例解析
|
存储 数据挖掘 数据库
data的含义与作用及使用方法
data的含义与作用及使用方法
6365 0
开发指南—Sequence—显示用法—查询与获取Sequence
本文主要介绍如何查询Sequence类型以及获取Sequence值。
189 0
开发指南—Sequence—显示用法—删除Sequence
本文主要介绍如何删除已经创建的Sequence。
|
C# .NET 开发框架
C# List 用法与示例
Problem. You have questions about the List collection in the .NET Framework, which is located in the System.
1084 0
|
测试技术
[20120513]update的新用法[补充].txt
昨天看了一篇文章http://www.toadworld.com/Blogs/tabid/67/EntryId/883/-UPDATE.aspxhttp://space.
657 0
Range对象基本操作应用示例(1)
Range对象可能是VBA代码中最常用的对象,Range对象可以是某一单元格、某一单元格区域、某一行、某一列、或者是多个连续或非连续的区域组成的区域。下面介绍Range对象的一些属性和方法。- - - - - - - - - - - - - - - - - - - - - - - - - - - -...
812 0