Parsing MAC in linux with grep or awk

Anything relates to software

Parsing MAC in linux with grep or awk

Postby LuKhach » Wed Jan 11, 2012 11:59 am

*> ip link show eth0 | awk '/ether/ {print $2}'
00:0c:29:30:21:48

OR

*>ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'
00:0c:29:30:21:48
User avatar
LuKhach
 
Posts: 67
Joined: Tue Jun 14, 2005 4:11 pm
Location: San Jose

Return to Software & Techniques

Who is online

Users browsing this forum: No registered users and 6 guests

cron