标签:多个 重复 awk roo nbsp conf ddr ifconf grep
ifconfig eth0 | sed -n ‘2p‘| awk ‘{print $2}‘ | awk -F: ‘{print $2}‘
ifconfig eth0 | grep "inet addr" | cut -d: -f2 | cut -d" " -f1
ifconfig eth0 | sed -n ‘2p‘| awk -F "[: ]+" ‘{print $4}‘ # +重复前面多个分隔符 [空格,冒号为分隔符]
ifconfig eth0 | awk -F "[: ]+" ‘NR==2 {print $4}‘
[root@augustyang 123]# sed ‘s#\(ddd\) \(kkk\)##g‘ test.txt
[root@augustyang 123]# sed ‘s#\(ddd\) \(kkk\)#\1#g‘ test.txt
ddd
[root@augustyang 123]# sed ‘s#\(ddd\) \(kkk\)#\1 \2#g‘ test.txt
ddd kkk
[root@augustyang 123]# stat /etc | sed -n ‘4p‘| awk -F"[(/]" ‘{print $2}‘
0755
[root@augustyang 123]# stat /etc | awk -F "[(/]" ‘ NR ==4 {print $2}‘
0755
标签:多个 重复 awk roo nbsp conf ddr ifconf grep
原文地址:http://www.cnblogs.com/augustyang/p/6049225.html