[admin@w ~]$ ifconfig eth0 |grep 'inet '|sed 's/inet//g' |sed 's/netmask.*$//g'
使用sed过滤IP地址信息
该命令行用于在Linux系统中,通过ifconfig命令获取eth0网络接口的IP地址,然后使用grep过滤inet行,再用sed命令去除不必要的一部分,最终显示纯IP地址。
该命令行用于在Linux系统中,通过ifconfig命令获取eth0网络接口的IP地址,然后使用grep过滤inet行,再用sed命令去除不必要的一部分,最终显示纯IP地址。
[admin@w ~]$ ifconfig eth0 |grep 'inet '|sed 's/inet//g' |sed 's/netmask.*$//g'
8768

被折叠的 条评论
为什么被折叠?