Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GREP Regex Patterns

Status
Not open for further replies.

TamedTech

IS-IT--Management
May 3, 2005
998
GB
Hello Guys,

I'm terrible with regex patterns, but i'm looking to grep out a MAC address, which foolows the following pattern.

XX:XX:XX:XX:XX:XX

And the X's can be iether Numbers or Letters.

How could i build this into a GREP statement with the regex pattern.

Thanks,

Rob
 
How about:
[tt]
grep -i '[0-9a-f]\{2\}:[0-9a-f]\{2\}:[0-9a-f]\{2\}:[0-9a-f]\{2\}:[0-9a-f]\{2\}:[0-9a-f]\{2\}'
[/tt]
This seems to work with GNU grep.
 
Hey Chapps,

Thanks for those suggestions, i'll give them a run through in the morning and let you know how I get on, this should make life much more efficient than my current process's.

Many Thanks,

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top