[geeks] regex question, I suppose...

Dan Debertin geeks at sunhelp.org
Fri Aug 24 00:49:32 CDT 2001


On Fri, 24 Aug 2001, Tim Harrison wrote:
>
> Let's say I have a listing of a few thousand MAC addresses in the Cisco
> style format ( xxxx.xxxx.xxxx ) and I want to change those into the
> standard format ( xx.xx.xx.xx.xx.xx ).  What would one use?

Here's what I came up with, just banging stuff out off the top of my head:

sed 's/^\([0-9a-f]\{2\}\)\([0-9a-f]\{2\}\)\.\([0-9a-f]\{2\}\)\([0-9a-f]\{2\}\)\.\([0-9a-f]\{2\}\)\([0-9a-f]\{2\}\)/\1:\2:\3:\4:\5:\6/'

Works for me ;)

Dan
--
Dan Debertin
airboss at nodewarrior.org
www.nodewarrior.org




More information about the geeks mailing list