Software Update reporting script

I need a script that gets the output of softwareupdate -al on each machine (the list of available updates) and reports how many updates are needed in total by all the machines on the network, and the results to 4 different recipients.

i.e.
total patches required = 12

hostname1 =4 patch(es)
hostname2=3 patch(es)
hostname3=4 patch(es)
hostname4=1 patch(es)

I'm not seeing the -l option in man softwareupdate, but it ran without complaining in my one test (on a machine that needed no updates).

You should be able to grep the lines relating to software updates, then pipe to "wc -l"

Store that in a variable, then write the host name and update count to a file, presumable with an easily parsible delimiter (like "=" for instance).

Push the file to a central mutually accessible location, then cat the files.
From there you can create your report.

The important part is determining the unique character/s you want to grep for on the hosts, before writing the host specific reports. It's pretty easy to determine from the "man" output, and running the command on a few machines that actually need updates.