Re: [OCLUG-Tech] How to convert a character MAC address into individual hex bytes for writing?

2017-07-28 Thread Alex Pilon
On Fri, Jul 28, 2017 at 07:22:16AM -0400, Robert P. J. Day wrote: > OK, this exercise should be a bit trickier -- given a character MAC > address, how can I break it into individual hex chars for writing to > EEPROM? So the script takes the argument, say, "A0:B1:C2:D3:E4:F5", > and I need to,

Re: [OCLUG-Tech] How to convert a character MAC address into individual hex bytes for writing?

2017-07-28 Thread Stephen M. Webb
On 2017-07-28 09:06 AM, Stephen M. Webb wrote: > > You could also go for sed instead. > > $ for c in $(echo A0:B1:C2:D3:E4:F5 | sed > 's/\([[:xdigit:]]\{2,2\}\)[^[:xdigit:]]*/ 0x\1/g'); do echo $c; done > 0xA0 > 0xB1 > 0xC2 > 0xD3 > 0xE4 > 0xF5 > > but the readability of that is questionable.

Re: [OCLUG-Tech] How to convert a character MAC address into individual hex bytes for writing?

2017-07-28 Thread Stephen M. Webb
On 2017-07-28 07:22 AM, rpj...@crashcourse.ca wrote: > > OK, this exercise should be a bit trickier -- given a character MAC > address, how can I break it into individual hex chars for writing to > EEPROM? So the script takes the argument, say, "A0:B1:C2:D3:E4:F5", > and I need to, one nibble

Re: [OCLUG-Tech] How to convert a character MAC address into individual hex bytes for writing?

2017-07-28 Thread Peter Sjöberg
On 28/07/17 07:22 AM, rpj...@crashcourse.ca wrote: > > OK, this exercise should be a bit trickier -- given a character MAC > address, how can I break it into individual hex chars for writing to > EEPROM? So the script takes the argument, say, "A0:B1:C2:D3:E4:F5", > and I need to, one nibble at