I am writing some code. I want to extract from "ifconfig" the device names and IP addresses. For example this expression will get me a result I want:
Code:
ifconfig | egrep "Ethernet|Bcast"
Here is the output:
ath0 Link encap:Ethernet HWaddr 00:17:9A:75:CA:A6
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
Then I got to thinking: how do I cope with phrases (in the future). For example what would be the grep command to return lines containing the phrases 'Ethernet HW' and ' Bcast' (that's Bcast with a space in front of it)?

I need phrases because I want to grep files like smb.conf for lines containing phrases like these:
name resolve order
netbios name
map to guest

I've looked at 'man grep' and it just leaves me confused for this level of detail.

Thanks