[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]
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 -- 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