Simpler Navigation for Servers and Operating Systems
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to get the Mac address....

SOLVED
Go to solution
Karthik_sg
Frequent Advisor

how to get the Mac address....

hi ppl,
I am using the following in the shell script
#!/bin/sh
MAC=`ifconfig | grep 'HWaddr '|cut -f 11 -d" "` ;
echo "$MAC";

But the output is 00:30:18:1D:4C:5A
And the desired output is 0030181D4C5A

Just tel me how to go about it.Thnks in advance


3 REPLIES
Denver Osborn
Honored Contributor
Solution

Re: how to get the Mac address....

MAC=`ifconfig | awk '/HWaddr/{print $NF}'|sed 's/://g'`
echo "$MAC"


-denver
skt_skt
Honored Contributor

Re: how to get the Mac address....

could you make your name a little smaller?
rick jones
Honored Contributor

Re: how to get the Mac address....

slight drift, but if the general way to express a MAC address is with the ':' in place, so if there is software out there which takes a MAC address and cannot handle the ':' it might be good to ask that it be fixed to do so.
there is no rest for the wicked yet the virtuous have no pillows