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