Getting Mac serial number

staxas's icon

I am writing licensing code and am trying to find a way to get the unique mac serial out of the shell object. Only thing is, shell doesn't accept lines like this:

ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, """); printf("%sn", line[4]); }'

I understand something can be done with sprintf, but I have no knowledge of scripting.

Anyone have any tips?

Fratzen's icon

send this to shell works for me:
ioreg -l | grep IOPlatformSerialNumber

print: " | "IOPlatformSerialNumber" = "***********""

regexp this answer and it's done

staxas's icon

Thanks, that's more than I got in the first place!

I'm not getting the hang of regexp. How can you use it to strip the number from this string?

staxas's icon

Does the serial always start with a W?

Ad.'s icon

here's:

Max Patch
Copy patch and select New From Clipboard in Max.

`

ad