Sponsored Content
Operating Systems Solaris Host name in front of pkginfo output Post 302894284 by busi386 on Monday 24th of March 2014 04:43:28 PM
Old 03-24-2014
Your modifications worked like a charm. Please mark resolved.

Code:
#!/bin/sh
# Previous line specifies the shell that is to be used to interpret this script.
host=`uname -n`        # Get system host name.
# Invoke pkginfo and feed the output into awk.  Set the awk variable "host" to
# the same value stored in the shell variable "host".
pkginfo -l | /usr/xpg4/bin/awk -v host="$host" '
/NAME:/ {       # For every line in the input file that contains "NAME:"...
        gsub(/(^ *NAME: *)|( *$)/, "")  # remove leading spaces, "NAME:" and any
                                        # spaces following it, and remove
                                        # trailing spaces from the current input
                                        # line.
        printf("%s,\"%s\",", host, $0)  # Print the host name and the quoted
                                        # NAME: field.  Note that printf() does
                                        # not add a <newline> unless explicitly
                                        # told to do so.
        next    # Skip remaining actions for this line and start processing the
                # next input line.
}
/VERSION:/ {    # Perform similar processing for lines containing "VERSION:"...
        gsub(/(^ *VERSION: *)|( *$)/, "")
        printf("\"%s\",", $0)
        next
}
/BASEDIR:/ {    # Perform similar processing for lines containing "BASEDIR:"...
        gsub(/(^ *BASEDIR: *)|( *$)/, "")
        print   # Note that print() (without arguments) prints the (modified)
                # contents of the current line and adds a trailing <newline>
                # character.
}'

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

format and pkginfo -l question

I have a Solaris 2.6 box flagging an "Error block: 308918" in the messages file when I execute a pkginfo -l. pkginfo with no flags returns no errors. I think I need to use format to mark this block and then restore the database used by pkginfo for backup. Any advice/input welcome. Thanks (4 Replies)
Discussion started by: 98_1LE
4 Replies

2. UNIX for Dummies Questions & Answers

Sending tar output to a remote host

Our group has recently inherited 15 servers that have not been maintained for over a year. My first action is to backup the units however there is not enough disk space on most of them to run tar. My supervisor said to look at piping the tar output to another machine, however I have been unable... (3 Replies)
Discussion started by: thumper
3 Replies

3. Solaris

difference between pkginfo and pkgchk command

can anyone explain me the difference between pkginfo and pkgchk command in solaris. Both are used to display the package details, then what is the difference between both. (5 Replies)
Discussion started by: rogerben
5 Replies

4. UNIX for Advanced & Expert Users

rpm and pkginfo question

Can the root hide some of the results of the above commands from a regular user? i.e. $>rpm and $>sudo rpm will give different results (1 Reply)
Discussion started by: noam128
1 Replies

5. Solaris

grep help with pkginfo

im looking for a way to eliminate the packages from SUN when i do a pkginfo. thought this would work, but no luck. pkginfo | grep what am i doing wrong? Thanks (2 Replies)
Discussion started by: jrich523
2 Replies

6. Shell Programming and Scripting

rsh to many hosts the ftp output to single host

Hi guys. i need some help, i need to create a script in tcsh that rsh into all my hosts that we have at our business, then cd to a directory (cd /apps/users) then grab a file from the users folder and ftp it back to my windows machine. can someone please help? Kind regards. Brian Behrens (2 Replies)
Discussion started by: brian112
2 Replies

7. Solaris

pkgadd, pkginfo, ssh not working

Got a feeling someone has been fiddling around or something has got corrupt but I'm getting the following errors now:- -bash-3.00# pkginfo ld.so.1: pkginfo: fatal: libssl.so.0.9.7: open failed: No such file or directory Killed -bash-3.00# and also ssh:- -bash-3.00# ssh ld.so.1: ssh:... (5 Replies)
Discussion started by: psychocandy
5 Replies

8. Solaris

Host name in front of ps output

hello All. I am working on something that should be really simply. It turns out that its not. I am trying to produce output to list the hostname along with all the current running programs. the script im using is: for PS in `ps -Ao "user,args" | cut -d' ' -f1,2` do echo "`uname -n`, $PS"... (5 Replies)
Discussion started by: busi386
5 Replies

9. UNIX for Dummies Questions & Answers

How to get/print host string only from tnsping output?

Hello All, I am using Linux OS. My idea is get the host name when we do tnsping in oracle. output of : tnsping DOELO01 TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 15-OCT-2015 20:20:05 Copyright (c) 1997, 2011, Oracle. All rights reserved. Used parameter files:... (2 Replies)
Discussion started by: Ariean
2 Replies

10. UNIX for Beginners Questions & Answers

Output top line for each unique host

Hi All, Please can you help with the output whole line for each host (column 3) and the top line of column 9 - the lastest only What is being outputted 243272484 3 nbmedln1p03 LDN_TEST_UX_JM 1488198368 0000000007 1 INC_1MTH 0 ********** 243272492 3 nbmedln1p03 LDN_TEST_UX_JM... (10 Replies)
Discussion started by: Junes
10 Replies
install-solaris(1M)													       install-solaris(1M)

NAME
install-solaris - install the Solaris operating system SYNOPSIS
install-solaris install-solaris invokes the Solaris Install program. Depending on graphical capability and available memory at the time of invocation, install-solaris invokes either a text-based installer or a graphical installer. The following minimum requirements for physical memory dictate which features are available during installation: For SPARC machines: 128 MB Minimum physical memory for all installation types 128 MB Minimum physical memory required for windowing system 384 MB Minimum physical memory required for graphical-based installation For x86 machines: 256 MB Minimum physical memory for all installation types 256 MB Minimum physical memory required for windowing system 512 MB Minimum physical memory required for graphical-based installation In some cases, even if the minimum physical memory is present, available virtual memory after system startup can limit the number of fea- tures available. install-solaris exists only on the Solaris installation media (CD or DVD) and should be invoked only from there. Refer to the for more details. install-solaris allows installation of the operating system onto any standalone system. install-solaris loads the software available on the installation media. Refer to the for disk space requirements. Refer to the for more information on the various menus and selections. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcdrom (Solaris instal- | | |lation media) | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ pkginfo(1), install(1M), pkgadd(1M), attributes(5) It is advisable to exit install-solaris by means of the exit options in the install-solaris menus. 23 Sep 2005 install-solaris(1M)
All times are GMT -4. The time now is 12:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy