[root@YZC ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:86:02:03
inet addr:59.151.110.2  Bcast:59.151.110.255  Mask:255.255.255.0
#->IP:59.151.110.2是我们要单独提取出来的;
inet6 addr: fe80::20c:29ff:fe86:203/64 Scope:Link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:2600 errors:0 dropped:0 overruns:0 frame:0
TX packets:921 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:238456 (232.8 KiB)  TX bytes:96528 (94.2 KiB)
Interrupt:59 Base address:0x2000

[root@YZC ~]# ifconfig eth0 | grep Bcast  #->以"Bcast"为关键字,将IP所在行给过滤出来;
inet addr:59.151.110.2  Bcast:59.151.110.255  Mask:255.255.255.0
[root@YZC ~]# ifconfig eth0 | grep Bcast | awk -F: '{print $2}'
#->过滤出来之后我们运用awk命令再进行操作;
#->-F: '{print $2}'  表示以":"为分隔符,并打印出第二个字段的内容
59.151.110.2  Bcast
[root@YZC ~]# ifconfig eth0 | grep Bcast | awk -F: '{print $2}' | awk -F " " '{print $1}'
#->再次将以上的字段通过awk命令进行截取;
59.151.110.2
~