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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert MAC addresses... 1

Status
Not open for further replies.

ogniemi

Technical User
Nov 7, 2003
1,041
PL

how to convert list of MAC accresses in following format:

0.d.60.4d.fa.f
0.9.6c.2e.37.8e

to format:

00:0D:60:4D:FA:0F
00:09:6C:2E:37:8E

regards.
 
One way:
Code:
awk -F. 'NF==6{printf "%02s:%02s:%02s:%02s:%02s:%02s\n",$1,$2,$3,$4,$5,$6}' /path/to/input > output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I don't want to nit-pick but...

Code:
awk -F. 'NF==6{[red]$0=toupper($0)[/red];printf "%02s:%02s:%02s:%02s:%02s:%02s\n",$1,$2,$3,$4,$5,$6}' /path/to/input > output

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top