[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
On Tue, 1 Apr 2008 07:47:04 +0100, Tom Potts wrote:
> On Monday 31 March 2008 15:09, Martijn wrote:
>> On Mon, Mar 31, 2008 at 2:35 PM, Grant Sewell wrote:
>> > Running 'ifconfig | grep "HWaddr"' (without the ' marks) gives me:
>> > eth1 Link encap:Ethernet HWaddr 00:14:22:43:0D:FB
>> > How can I remove everything bar the 00:14:22:43:0D:FB ?
>>
>> ifconfig | grep "HWaddr" | cut -d' ' -f11
>>
>> This cuts your output into slices using a space as a delimiter (-d' ')
>> and then outputs only the 11th slice (-f11). Which in this case gives
>> you 00:14:22:43:0D:FB. Of course, it will fail to work if your output
>> line might have more or less spaces before the MAC address. If this
>> might happen -- I am not very familiar with ifconfig -- you might need
>> to use a slightly more intelligent version of cut and/or put a sed in
>> the pipeline.
> Not likely for most but what about clusters etc where IP and MAC will be
> 'copied' across several machines?
> Tom te tom te tom
A good point, but one that isn't a concern for me since all the machines I
will be using this on will have precisely 1 Ethernet network card and
precisely 1 IP address.
Which brings me to another question... why does GNU/Linux seem to give
different ethX devices? The machine I'm sitting at right now (a Dell
Optiplex GX620) produces the following:
gsewell@penguin:~$ ifconfig -a
eth1 Link encap:Ethernet HWaddr 00:14:22:43:0D:FB
inet addr:10.23.1.63 Bcast:10.23.255.255 Mask:255.255.0.0
inet6 addr: fe80::214:22ff:fe43:dfb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:210014 errors:0 dropped:0 overruns:0 frame:0
TX packets:25046 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:35494566 (33.8 MB) TX bytes:2954777 (2.8 MB)
Interrupt:16
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2683 errors:0 dropped:0 overruns:0 frame:0
TX packets:2683 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4523747 (4.3 MB) TX bytes:4523747 (4.3 MB)
gsewell@penguin:~$
What happened to eth0?
Grant.
--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html