正则表达式打印本机IP、广播、子网掩码地址
发布时间:2020-12-14 04:34:20 所属栏目:百科 来源:网络整理
导读:方法1:sed查询打印 [root@Linux9~]#ifconfigeth0|grep"inetaddr:"|sed's/Bcast.*$//'g|sed's/.*://g'192.168.25.57 方法2:awk查询打印 [root@Linux9~]#ifconfigeth0|grep"inetaddr:"|sed's/Bcast.*$//'g|awk-F":"{'print$2'}192.168.25.57 方法3:cut分段
方法1:sed查询打印 [root@Linux9~]#ifconfigeth0|grep"inetaddr:"|sed's/Bcast.*$//'g|sed's/.*://g' 192.168.25.57 方法2:awk查询打印 [root@Linux9~]#ifconfigeth0|grep"inetaddr:"|sed's/Bcast.*$//'g|awk-F":"{'print$2'} 192.168.25.57 方法3:cut分段打印 [root@Linux9~]#ifconfigeth0|grep'Bcast'|cut-d':'-f3|cut-d""-f1 192.168.31.255 方法4:awk查询打印子网掩码 [root@Linux9~]#ifconfigeth0|grep'Mask'|awk-F:'{print$4}' 255.255.240.0 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |