Linux-cut

作者: ssttIsme | 来源:发表于2023-07-28 15:23 被阅读0次
    [root@hadoop102 scripts]# cat cut.txt
    guang zhou
    shen zhen
    dong guan
    zhong shan
    [root@hadoop102 scripts]# cut -d " " -f 1 cut.txt 
    guang
    shen
    dong
    zhong
    [root@hadoop102 scripts]# cut -d " " -f 2,3 cut.txt   
    zhou
    zhen
    guan
    shan
    [root@hadoop102 scripts]# cat /etc/pd|grep bash$
    root:x:0:0:root:/root:/bin/bash
    server:x:1000:1000:server:/home/server:/bin/bash
    [root@hadoop102 scripts]# cat /etc/pd|grep bash$| cut -d ":" -f 1,6,7
    root:/root:/bin/bash
    server:/home/server:/bin/bash
    [root@hadoop102 scripts]# cat /etc/pd|grep bash$| cut -d ":" -f 1-4
    root:x:0:0
    server:x:1000:1000
    [root@hadoop102 scripts]# cat /etc/pd|grep bash$| cut -d ":" -f 4-
    0:root:/root:/bin/bash
    1000:server:/home/server:/bin/bash
    [root@hadoop102 scripts]# cat /etc/pd|grep bash$| cut -d ":" -f -4
    root:x:0:0
    server:x:1000:1000
    [root@hadoop102 scripts]# ifconfig ens33|grep netmask|cut -d " " -f 10
    192.168.100.102
    [root@hadoop102 scripts]# ifconfig|grep netmask|cut -d " " -f 10      
    10.244.0.1
    172.17.0.1
    192.168.100.102
    10.244.0.0
    127.0.0.1
    192.168.122.1
    

    相关文章

      网友评论

          本文标题:Linux-cut

          本文链接:https://www.haomeiwen.com/subject/ybyxsdtx.html