Linux-cut

2023-07-28  本文已影响0人  ssttIsme
[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
上一篇下一篇

猜你喜欢

热点阅读