When I do my lookups I use SqlYOG running in wine. I when I formulate my queries I can use MySQL's 0x100000000001 syntax if it's just one MAC address. If there are more MAC addresses I can use a simple set of shell functions defined in a shell library file and sourced in my .bashrc to convert them for me.
h2d(){ mac=$(echo $1 | tr '[:lower:]' '[:upper:]') echo "ibase=16; ${mac}"|bc } d2h(){ mac=$(echo $1 | tr '[:lower:]' '[:upper:]') echo "obase=16; ${mac}"|bc } dhall(){ for ii in $* do printf "%012X " $ii done echo } hdall(){ for ii in $* do h='0x'$(echo $ii | tr '[:lower:]' '[:upper:]') printf "%d " $h done echo }
hdall converts hex numbers to base 10 and dhall converts a base 10 integer to hex. This is handy at the shell in case I'm using the MySQL command line utility.
I've included some older variants where I used bc as my converter. You'll find that the printf versions are much faster, however, not all unix shells or unix flavors offer bash and printf. You may need the bc versions for those.
Also notice that I move all of the hex characters to uppercase for conversion. The bc utility won't take the alpha characters if they are in lower case.
Let's say I have the following for integer MAC addresses someone gives me.
207299441470 207299462794 207299730467442 207299474
I can use dhall to convert them to hex and I can use hdall to convert them back. Using printf it's easy to pad the hex numbers out to the correct length.
[gail@gail]$ dhall 7299441470 207299462794 207299730467442 207299474 0001B314A33E 00304402C68A BC89BACBEA72 00000C5B2392 [gail@gail]$ hdall 0001B314A33E 00304402C68A BC89BACBEA72 00000C5B2392 7299441470 207299462794 207299730467442 207299474