通过awk取IP地址
awk -F 字符 以字符作为间隔符
- #ifconfig |grep "inet addr:"
- inet addr:10.241.50.63 Bcast:10.241.50.255 Mask:255.255.255.0
- # ifconfig |grep "inet addr:"|grep -v "127.0.0.1"|awk '{print $2}'
- addr:10.241.50.63
- # ifconfig |grep "inet addr:"|grep -v "127.0.0.1"|awk '{print $2}'|awk -F : '{print $2}'
- 10.241.50.63
- # ifconfig |grep "inet addr:"|grep -v "127.0.0.1"|awk '{print $2}'|awk -F : '{print $2}'|awk -F . '{print $1"."$2"."$3"."0}'
- 10.241.50.0