shell中常用命令
阿新 • • 發佈:2018-07-02
local 特殊符號 head var sort 分隔 cut命令 tee -c shell特殊符號cut命令
* *號表示統配字符
? ?表示一個任意字符
# #號註釋字符,被註釋的內容不會生效
\ \符號表示脫意字符,給特殊符號脫離原有的特殊用法
* *號表示統配字符
? ?表示一個任意字符
# #號註釋字符,被註釋的內容不會生效
\ \符號表示脫意字符,給特殊符號脫離原有的特殊用法
cut用於分段
cut -d 分割符 -f 過濾字段 /文件
-d 指定分割符,使用逗號分隔可以顯示多個字段,如3,6
-f 指定第幾列字符
-c 切割區間字符,如3-6區間的字符
[root@localhost tmp]# cat passwd |head -5 |cut -d ":" -f 1 cut截取第一段內容 root bin daemon adm lp [root@localhost tmp]# cat passwd |head -5 |cut -d ":" -f 1,2 cut截取第1、2段內容 root:x bin:x daemon:x adm:x lp:x [root@localhost tmp]# cat passwd |head -5 |cut -d ":" -f 1-3 cut截取1到3段內容 root:x:0 bin:x:1 daemon:x:2 adm:x:3 lp:x:4 [root@localhost tmp]# cat passwd |head -5 |cut -d ":" -f 1,3,6 cut截取1、3、6段內容 root:0:/root bin:1:/bin daemon:2:/sbin adm:3:/var/adm lp:4:/var/spool/lpd
sort_wc_uniq命令
tee_tr_split命令
shell特殊符號下
shell中常用命令