亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Linux seq命令的使用詳解

 更新時間:2020年02月17日 12:14:21   作者:滄海一笑-dj  
這篇文章主要介紹了Linux seq命令的使用詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

01. 命令概述

seq命令用于產(chǎn)生整數(shù)序列。

02. 命令格式

用法:

 seq [選項]... 尾數(shù)
 seq [選項]... 首數(shù) 尾數(shù)
 seq [選項]... 首數(shù) 增量 尾數(shù)

03. 常用選項

以指定增量從首數(shù)開始打印數(shù)字到尾數(shù)。

 -f, --format=格式   使用printf 樣式的浮點格式
 -s, --separator=字符串    使用指定字符串分隔數(shù)字(默認(rèn)使用:\n)
 -w, --equal-width   在列前添加0 使得寬度相同
   --help      顯示此幫助信息并退出
   --version     顯示版本信息并退出

04. 參考示例

4.1 輸出1-5

[deng@localhost ~]$ seq 5 
1
2
3
4
5
[deng@localhost ~]$ 

4.2 輸出1-5

[deng@localhost ~]$ seq 1 5
1
2
3
4
5
[deng@localhost ~]$ 

4.3 輸出3-5

[deng@localhost ~]$ seq 3 5 
3
4
5
[deng@localhost ~]$ 

4.4 輸出1 4 7 10

[deng@localhost ~]$ seq 1 3 10
1
4
7
10
[deng@localhost ~]$ 

4.5 指定格式輸出

[deng@localhost ~]$ seq -f "%3g" 9 11
 9
 10
 11
[deng@localhost ~]$ 

意思是-f指定格式,%后面指定3位數(shù),默認(rèn)是%g,%3g不夠位數(shù)的地方都是空格填補(bǔ)

4.6 指定格式輸出

[deng@localhost ~]$ seq -f "%03g" 9 11
009
010
011
[deng@localhost ~]$ 

意思是打印三位,不足的地方用0填補(bǔ)

4.7 指定格式輸出

[deng@localhost ~]$ seq -f "str%03g" 9 11
str009
str010
str011
[deng@localhost ~]$ 

意思是打印三位不足的地方以0填補(bǔ),在前面加上str

4.8 在列前添加0使得寬度相同

[deng@localhost ~]$ seq -w 9 11
09
10
11
[deng@localhost ~]$ 
 

當(dāng)輸出等寬字符串時不應(yīng)再指定格式字符串,-w與-f不能一起用

4.9 使用指定字符串分隔數(shù)字

[deng@localhost ~]$ seq -s " " -f "str%03g" 9 11
str009 str010 str011
[deng@localhost ~]$ 
 

4.10 使用tab鍵分隔數(shù)字

[deng@localhost ~]$ seq -s "`echo -e '\t'`" 9 11
9    10   11
[deng@localhost ~]$ 
 

先用命令做成一個tab,然后再指定成分隔符

05. 附錄

參考: 【Linux】一步一步學(xué)Linux系列教程匯總

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論