The following script:
IP=`ifconfig en0 inet | grep inet | sed 's/.*inet *//; s/ .*//'`
isolates the IP address from ipconfig
command and puts it into the variable $IP
.
How can I now isolate the last octet from the said IP address and put it in a second variable - $CN
for instance:
$IP = 129.66.128.72 $CN = 72 or $IP = 129.66.128.133 $CN = 133...