Getting Mac serial number


    May 17 2011 | 8:10 am
    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?

    • May 17 2011 | 9:20 am
      send this to shell works for me:
      ioreg -l | grep IOPlatformSerialNumber
      print: " | "IOPlatformSerialNumber" = "***********""
      regexp this answer and it's done
    • May 17 2011 | 9:54 am
      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?
    • May 17 2011 | 10:02 am
      Does the serial always start with a W?
    • May 17 2011 | 12:45 pm
      here's:
      `
      ad