[CentOS] GRabbing MAC address

Thu Feb 28 14:03:51 UTC 2008
Matt Hyclak <hyclak at math.ohiou.edu>

On Thu, Feb 28, 2008 at 08:56:49AM -0500, Max Hetrick enlightened us:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Toby Bluhm wrote:
> 
> > There's multiple spaces in the output that cut is hitting - use tr to
> > reduce them.
> > 
> > ifconfig | grep eth0 | tr -s ' ' ' ' | cut -d ' ' -f 5
> 
> Or:
> 
> ifconfig | grep eth0 | cut -d ' ' -f 11
> 

Or reduce the number of pipes by one:

ifconfig eth0 | awk '/HWaddr/ { print $5 }'

Matt

-- 
Matt Hyclak
Department of Mathematics 
Department of Social Work
Ohio University
(740) 593-1263