i am trying to extract only the active interfaces on my machine,i have a script that auto connect and disconnect running,and the interfaces are like this when i run ifconfig
tun1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.9.8.1 P-t-P:10.9.8.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:13 errors:0 dropped:0 overruns:0 frame:0
TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:2262 (2.2 KiB) TX bytes:1819 (1.7 KiB)
tun 5
tun 7
...etc
how can i extract only the interface names
ifconfig | grep "Link encap" | awk '{ print $1 '}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.