[HPADM] Summary2: Awk and $PATH

SAbramson_at_Wabtec.com
Date: 01/29/04

  • Next message: brian irvin: "[HPADM] Total Cpu, Memory using script."
    To: hpux-admin@dutchworks.nl
    Date: Thu, 29 Jan 2004 15:14:39 -0500
    
    

    hpux-admins:
     

    David Totsch had another suggestion:
     
        echo $PATH | awk 'BEGIN {RS=":"} {print $1 }'
     
    George's, again, was:
     
            echo $PATH | tr ':' '\n'
     
    What I wanted to do was put every $PATH directory on a seperate line...
     
    Both do the trick.
     
     
        Stuart
     

    Stuart Abramson | WABTEC Corp. | Wilmerding, PA
    Off: 412/825-1434 | Cell: 412/417-1567 | email: sabramson@wabtec.com

     

      _____

    From: hpux-admin-owner@DutchWorks.nl [mailto:hpux-admin-owner@DutchWorks.nl]
    On Behalf Of Abramson, Stuart
    Sent: Thursday, January 29, 2004 2:50 PM
    To: hpux-admin@dutchworks.nl
    Subject: [HPADM] RE: Awk and $PATH

    Thanks to:
     
        George Bodnar
        Christopher Schroen
        Alan Riggs
        Leon Kazakin
        Richard Wright
     
    George's solution below...
     
        Stuart

    Stuart Abramson | WABTEC Corp. | Wilmerding, PA
    Off: 412/825-1434 | Cell: 412/417-1567 | email: sabramson@wabtec.com

     

      _____

    From: Bodnar, George [mailto:gbodnar@ppg.com]
    Sent: Thursday, January 29, 2004 2:18 PM
    To: Abramson, Stuart
    Subject: RE: [HPADM] Awk and $PATH

    Because $0 is the whole line not a record - you'd have to right a loop to
    print each record in awk to achieve what you want.
     
    echo $PATH | tr ':' '\n'

    -----Original Message-----
    From: SAbramson@Wabtec.com [mailto:SAbramson@Wabtec.com]
    Sent: Thursday, January 29, 2004 2:11 PM
    To: hpux-admin@dutchworks.nl
    Subject: [HPADM] Awk and $PATH

    Can someone tell me why:

            if this works:

                    # echo $PATH | awk -F: '{print $1}'

                            /usr/sbin/

            why does't this work:

                    # echo $PATH | awk -F: '{OFS="\n";print $0}'

     
    /usr/sbin/:/usr/bin/:/usr/sbin:/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/con
    trib/bin:/opt/fc/bin:/opt/fcms/bin:/opt/nettladm/bin:/opt/upgrade/bin:/opt/p
    d/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/resmon/bin:/opt/pred/bin:/opt/h
    parray/bin:/opt/perf/bin:/opt/ignite/bin:/opt/cxperf/bin:/opt/langtools/bin:
    /opt/imake/bin://opt/perl/bin:/opt/aCC/bin:/opt/hpnp//bin:/opt/networker/bin
    :/opt/graphics/common/bin:/opt/samba-2.2.5/source/bin:/sbin:/home/root:/usr/
    emc/ECC/bin:/usr/symcli/bin:/usr/symmapps/vcm:/usr/local/bin:/home/saroot/bi
    n:/opt/perf/bin:/usr/symcli/bin:/usr/symcli64/bin/

    What I want to do, is separate each separate directory in $PATH on it's own
    line.

            Stuart

    Stuart Abramson | WABTEC Corp. | Wilmerding, PA
    Off: 412/825-1434 | Cell: 412/417-1567 | email: sabramson@wabtec.com

    ***** CONFIDENTIALITY NOTE *****
    The content contained in this e-mail transmission is legally privileged and
    confidential information intended only for the use of the individual or
    entity named herein. If the reader of this transmission is not the intended
    recipient, you are hereby notified that any dissemination, distribution, or
    copying of this transmission is strictly prohibited.

    ***** CONFIDENTIALITY NOTE *****
    The content contained in this e-mail transmission is legally privileged and
    confidential information intended only for the use of the individual or
    entity named herein. If the reader of this transmission is not the intended
    recipient, you are hereby notified that any dissemination, distribution, or
    copying of this transmission is strictly prohibited.

    ***** CONFIDENTIALITY NOTE *****
    The content contained in this e-mail transmission is legally privileged and confidential information intended only for the use of the individual or entity named herein. If the reader of this transmission is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this transmission is strictly prohibited.

    --
                 ---> Please post QUESTIONS and SUMMARIES only!! <---
            To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
           Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
     
     Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
                http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)
    

  • Next message: brian irvin: "[HPADM] Total Cpu, Memory using script."

    Relevant Pages