I wanted to split up an IP address in BASH so I could use it in my pppd ip-up script to check for a certain DNS server. Because the DNS server itself seemed to change a lot, I just wanted to check on the first three quads.
Assuming the IP address comes in on $DNS1 (as it does in /etc/ppp/ip-up):
1 2 | DNSIP=(${DNS1//./ }); #IPADDRESS=${DNSIP[0]}.${DNSIP[1]}.${DNSIP[2]}.${DNSIP[3]} |