I would like to be able to extract (from within a shell script) the attributes of an IPS package. Basically I'm after exact same information as is listed with the pkg info command, but unfortunately this command list information in a format which is not very friendly to read from within a script. Example below:$ pkg info archiver/gnu-tar          Name: archiver/gnu-tar       Summary: GNU version of the tar archiving utility   Description: Tar is a program for packaging a set of files as a single                archive in tar format.      Category: Development/GNU         State: Installed     Publisher: solaris       Version: 1.26 Build Release: 5.11        Branch: 0.175.0.0.0.2.537Packaging Date: October 19, 2011 09:11:16 AM          Size: 1.73 MB          FMRI: pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.0.0.0.2.537:20111019T091116ZI was hoping for something like pkg get-property pkg.summary archiver/gnu-tar to be available as a command but can't find such command. I would really hate to try to parse the above output. Secondly the man pages clearly states that the output from pkg info is intended to be read by humans, not machines.
Solaris 11: how to get pkg properties in machine readable format
package management;solaris
Most of what pkg info reports comes from the set actions in the package which define package attributes and other metadata.   For your example of archiver/gnu-tar:% pkg contents -t set -o name,value archiver/gnu-tarNAME                          VALUEinfo.classification           org.opensolaris.category.2008:Development/GNUinfo.source-url               http://ftp.gnu.org/gnu/tar/tar-1.26.tar.bz2info.upstream-url             http://www.gnu.org/software/tar/org.opensolaris.arc-caseid    PSARC/2000/488org.opensolaris.consolidation userlandpkg.description               Tar is a program for packaging a set of files as a single archive in tar format.pkg.fmri                      pkg://solaris/archiver/gnu-tar@1.26,5.11-0.175.1.0.0.20.0:20120709T173816Zpkg.summary                   GNU version of the tar archiving utilityvariant.arch                  ['i386', 'sparc']% pkg contents -H -t set -o value -a name=pkg.summary archiver/gnu-tarGNU version of the tar archiving utility