<p>What is the best way to extract the MAC address from <code>ifconfig</code>'s output?</p>

<p>Sample output:</p>

<pre><code>bash-3.00# ifconfig eth0        
eth0      Link encap:Ethernet  HWaddr 1F:2E:19:10:3B:52    
          inet addr:127.0.0.66  Bcast:127.255.255.255  Mask:255.0.0.0    
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          ....
          ....
</code></pre>

<p>Should I use cut, <a href="http://en.wikipedia.org/wiki/AWK" rel="noreferrer">AWK</a> or anything else, and what are the merits and demerits of one method over the other.</p>

Not sure whether there really are any advantages, but you can simply use awk:
```
```
ifconfig eth0 | awk '/HWaddr/ {print $5}'
```
```