[NCLUG] Regexp Help

Gabriel L Somlo somlo at CS.ColoState.EDU
Thu Jul 25 12:29:44 MDT 2002


use the '-o' flag to grep, which will only show the matching pattern
rather than the whole line containing it...

Hope this helps,

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