title: Extracting MAC address from ifconfig output
body: <p>I am writing a <code>#!bin/bash</code> shell script to automate MAC spoofing. In the script that I have written I make the outputs of <code>ifconfig -a | grep HWaddr</code> equivalent to two different variables. The command <code>ifconfig -a | grep HWaddr</code> returns </p>
  
  <pre><code>eth0  Link encap:Ethernet HWaddr 00:00:00:00:00:00
  </code></pre>
  
  <p>and </p>
  
  <pre><code>wlan0 Link uncap: Ethernet HWaddr 00:00:00:00:00:00
  </code></pre>
  
  <p>but I want the command to return <em>just</em> the MAC address for <code>wlan0</code>. </p>