Hi, sure -
1. I happen to use "awk" instead of "grep".
2. I get the MAC address from this command:
Quote:
/sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:40:F6:2C:6B:CC
inet addr:192.168.1.150 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:399879 errors:0 dropped:10 overruns:0 frame:0
TX packets:30434 errors:1 dropped:0 overruns:1 carrier:0
collisions:2749 txqueuelen:100
Interrupt:10 Base address:0xe800
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:74159 errors:0 dropped:0 overruns:0 frame:0
TX packets:74159 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
|
3. "awk" does two things:
a) This finds the line(s) that match "HWaddr" (much like "grep"):
b) This prints column 5 of the matching line(s):
'Hope that helps .. PSM
PS:
Please feel free to click the little blue "thumbs up" icon if this was useful.