[NCLUG] Regexp Help
Gabriel L Somlo
somlo at CS.ColoState.EDU
Thu Jul 25 14:02:12 MDT 2002
You could also replace all spaces with newlines using tr, then grep
for your MAC address, which will be guaranteed to be alone on a
separate line:
dmesg | tr '\ ' '\n' | grep ..:..:..:..:..:..
You might have to tweak the arguments to tr, but that's the general
idea...
Might this be a workable solution at all ?
Gabriel
--
-----------------------------------------------------------------------
Gabriel L. Somlo Assistant System Administrator
Computer Science Department
Colorado State University e-mail: somlo at cs.colostate.edu
601 Howes St. 2nd Floor phone: +1 (970) 491-5305
Fort Collins, CO 80523
-----------------------------------------------------------------------
On Thu, 25 Jul 2002, Michael Dwyer wrote:
> I'm trying to do something that seems sooooo panfully easy to do, but I
> cannot figure it out...
>
> This snippet returns anything in the kernel ring buffer that looks like
> a MAC address:
>
> dmesg | grep ..:..:..:..:..:..
>
> So I get lines like:
>
> foomatic.c Foo Ethernet Driver at 31:33:7b:ee:fc:ab. Initialized.
>
> How, using only tools like grep, awk, sed, printf, cut, etc, can I get
> ONLY the mac address? How do I get output like:
>
> 31:33:7b:ee:fc:ab
>
> Am I missing something totally obvious?
>
> _______________________________________________
> NCLUG mailing list NCLUG at nclug.org
>
> To unsubscribe, subscribe, or modify your settings, go to:
> http://www.nclug.org/mailman/listinfo/nclug
>
More information about the NCLUG
mailing list