国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

shell字符截取命令之cut命令的實例詳解

2019-10-26 18:54:56
字體:
來源:轉載
供稿:網友

shell字符截取命令之cut命令的實例詳解

一 語法

cut [選項] 文件名選項:-f 列號:提取第幾列-d 分隔符:按照指定分隔符分割列

 二 實戰

[root@localhost ~]# cat student.txt1 furong F 852 fengj F 603 cang F 70[root@localhost ~]# cut -f 2 student.txtfurongfengjcang[root@localhost ~]# cut -f 2,4 student.txtfurong 85fengj 60cang 70[root@localhost ~]# grep "/bin/bash" /etc/passwd|grep -v "root"|cut -f 1 -d ":"cakin24testcls[root@localhost ~]# cut -d ":" -f 1,3 /etc/passwdroot:0bin:1daemon:2adm:3lp:4sync:5shutdown:6halt:7mail:8operator:11games:12ftp:14nobody:99systemd-bus-proxy:999systemd-network:998dbus:81polkitd:997abrt:173unbound:996tss:59colord:995usbmuxd:113geoclue:994rpc:32rtkit:172chrony:993radvd:75qemu:107avahi-autoipd:170setroubleshoot:992rpcuser:29nfsnobody:65534saslauth:991libstoragemgmt:990pulse:171gdm:42gnome-initial-setup:989avahi:70sshd:74postfix:89ntp:38tcpdump:72cakin24:1000test:1003cls:1001

 三 cut命令的局限

df -h|cut -d " " -f 1,3

只能分割比較規則的文本,一般分割符是制表符或冒號。

不能簡單的用空格作為分割符。

如有疑問請留言或者到本站社區交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 兴国县| 崇阳县| 阆中市| 英吉沙县| 勐海县| 万全县| 张北县| 黎平县| 康平县| 克东县| 武威市| 湘潭县| 如皋市| 贵德县| 荣昌县| 涿州市| 芜湖市| 莎车县| 通州市| 临汾市| 于都县| 兰西县| 来安县| 鱼台县| 德阳市| 开平市| 昭平县| 淅川县| 黑山县| 碌曲县| 兴国县| 呈贡县| 金寨县| 新丰县| 清丰县| 姚安县| 玛沁县| 平果县| 夏邑县| 达拉特旗| 香河县|