Change format of list of mac addresses?

Discussion in 'Programming & Software Development' started by Myst, Feb 2, 2010.

  1. Myst

    Myst Member

    Joined:
    Feb 26, 2004
    Messages:
    1,174
    Location:
    Hobart, Tasmania
    Hi guys

    I have a list of 250 mac addresses in the format:

    00:1A:4B:C1:46:72

    I need to run something over this and turn them into this format:

    001A.4BC1.4672

    This will enable easier cross-referencing with some previous results I have.

    Can anyone recommend an easy way to achieve this?
     
  2. Taceo Corpus

    Taceo Corpus Member

    Joined:
    Sep 19, 2005
    Messages:
    3,247
    Location:
    Ho Chi Minh City, Vietnam
    Assuming they're in a text file, you can use find and replace to get rid of the colons, and then make a macro in something like notepad++ which is just ". downarrow" and select the appropriate point in the first line and run it until the end of the file.

    Just tried it then and it worked fine.
     
  3. zzzzz

    zzzzz Member

    Joined:
    Dec 25, 2001
    Messages:
    1,820
    Location:
    Sydney, Australia.
    If you have Excel handy:
    Cell A1 your original MAC
    Cell B1 =SUBSTITUTE(A1,":","")
    Cell C1 =MID(B1,1,4)&":"&MID(B1,5,4)&":"&MID(B1,9,4)

    Put original MACs into column A, 1 per cell
    Fill down column B and C
     
  4. dalek

    dalek Member

    Joined:
    Jun 27, 2001
    Messages:
    47
    Location:
    Wollongong
    awk -F':' '{print $1 $2 "." $3 $4 "." $5 $6}' inputfile.txt
     
  5. Myst

    Myst Member

    Joined:
    Feb 26, 2004
    Messages:
    1,174
    Location:
    Hobart, Tasmania
    Thanks guys all fantastic suggestions!

    Ended up using excel, worked a charm.
     

Share This Page