• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Computer Serial Number
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Computer Serial Number


  • Subject: Re: Computer Serial Number
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 24 Jul 2008 20:26:22 -0400

Ed> Um, yes. Just for jollies, I tried it and got nine serial numbers. Still,
Ed> the basic idea is a good one.

Heh.  Seven on my system.

Philip> do shell script "system_profiler SPHardwareDataType | grep
'Serial Number' |
Philip> tr -d ' ' | cut -d : -f 2"

Whenever I see grep | cut (with or without tr) I think "awk":

do shell script "system_profiler SPHardwareDataType  | awk '/Serial
Number:/ {print $NF}' "

You could also take advantage of the fact that the SPHardwareDataType
stuff comes first, and just do this:

do shell script "system_profiler | awk '/Serial Number:/ {print $NF; exit}' "

which was the solution I had come up with before reading Philip's
reply.  Admittedly that was based on a brute-force approach (i.e.
looking at the output) as opposed to a more nuanced method (i.e.
reading the man page for system_profiler.) :)


--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Computer Serial Number
      • From: email@hidden (Randal L. Schwartz)
References: 
 >Computer Serial Number (From: Oakley Masten <email@hidden>)
 >Re: Computer Serial Number (From: "Michael J. Vinca" <email@hidden>)
 >Re: Computer Serial Number (From: Ed Rush <email@hidden>)
 >Re: Computer Serial Number (From: Philip Aker <email@hidden>)

  • Prev by Date: iCal moving events to calendar not working
  • Next by Date: frontmost in Leopard vs Tiger
  • Previous by thread: Re: Computer Serial Number
  • Next by thread: Re: Computer Serial Number
  • Index(es):
    • Date
    • Thread