Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A shell script to get machine serial numbers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A shell script to get machine serial numbers
Authored by: j e v v on Sep 07, '04 03:20:11PM

Jerry,

"grep" is a filter program. By piping the output of system_profiler into it you tell the system to "display only the lines containing....". After the first grep there are no more lines left.

What you want is probably this:

system_profiler SPHardwareDataType | egrep "Serial Number|Machine Model|Memory|CPU" | sort

egrep is a version of grep that understands regular expressions. In this case you ask the system to "display all lines containing Serial Number OR Machine Model OR Memory OR CPU"

You can also sort the output like this:

system_profiler SPHardwareDataType | egrep "Serial Number|Machine Model|Memory|CPU"



[ Reply to This | # ]
A shell script to get machine serial numbers
Authored by: kjcase on Sep 08, '04 04:02:36PM

Fantastic! Works beautifully! This will save a lot of time creating an inventory, once I get the script put together.

Thanks again.

Jerry



[ Reply to This | # ]