获取当前机器的global ipv6地址
awk使用方法
awk 'pattern {action}' {filenames}
首先,用ifconfig命令可以查看当前机器的所有ip地址
[root@lc ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 38:83:45:F1:33:33
inet addr:192.168.1.13 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fc00:0:190::13/64 Scope:Global
inet6 addr: fe80::3a83:45ff:fef1:3333/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3097 errors:0 dropped:0 overruns:0 frame:0
TX packets:3404 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:380337 (371.4 KiB) TX bytes:400481 (391.0 KiB)
Interrupt:10 Base address:0xe000
eth1 Link encap:Ethernet HWaddr 50:E5:49:CF:97:BE
inet addr:192.168.106.239 Bcast:192.168.106.255 Mask:255.255.255.0
inet6 addr: fc00:0:190::221/64 Scope:Global
inet6 addr: fe80::52e5:49ff:fecf:97be/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:74167 errors:0 dropped:0 overruns:0 frame:0
TX packets:25655 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8107031 (7.7 MiB) TX bytes:25823486...