I have mac addresses in this shape "001122334455" that I want to turn into "00 11 22 33 44 55". I guess there is a way to do this in one line, but the only way I found is the following ridiculously horrible proc. Can someone show me how to do this properly ?
proc addSpaces { mac } {
set mac [split $mac {}]
set i 0
while { $i < 12 } {
if { [expr $i % 2] == 0 } {
append macAddr " "
append macAddr [lindex $mac $i]
append macAddr [lindex $mac [expr $i + 1]]
}
incr i
}
return $macAddr
}