hello.
I have network interfaces configuration file on debian - with a few stanzas like:
allow-hotplug eth2
iface eth2 inet static
address 192.168.198.24
netmask 255.255.255.0
broadcast 192.168.198.255
I'd like to extract from this file IP of address attribute of specific interface - for example eth2:
what I have now is:
awk 'BEGIN{RS=ORS="\n\n";FS=OFS="\n"}/eth2/' /etc/network/interfaces|awk '$1=="address"{print $2;exit}'
how to rid of last awk (pipe) and do in one?