[HPADM] Summary: Breaking up my $PATH into separate lines

From: Abramson, Stuart (SAbramson_at_Wabtec.com)
Date: 12/02/03

  • Next message: Patel Pankaj: "[HPADM] tar cvf , tar xvf"
    To: "Hpux-Admin (hpux-admin@dutchworks.nl)" <hpux-admin@dutchworks.nl>
    Date: Tue, 2 Dec 2003 11:08:12 -0500 
    
    

    Thanks to:

            Julius Szelagiewicz
            Bill Thompson
            Brett Geer

    Julius:

            Stuart,

            this is easy:

                    echo $PATH|sed -e 's/:/\^J/g' > pathtoedit
            
            will create file pathtoedit that contains each element in
            a separate line, edit it, and when you are done:

                     paste -s -d":" pathtoedit

            that's it. julius

    Brett's:

            yes, awk could well do this
     
            echo $PATH | awk -F":" '{for (loop=1;loop <= NF;loop++) printf
    $loop}'
     
            brett

    Bill's:

    Stuart,

    Here's a Perl script I wrote some time ago. By default it breaks $PATH into
    separate lines but you can specify any environmental variable (such as
    MANPATH) as well:

    - - - - - - - - - - snip - - - - - - - - - - #!/usr/bin/perl # # 05/00 wht;
    v1.00: Created
    #***************************************************************************
    **
    # showpath
    #***************************************************************************
    **
    #
    # PURPOSE
    # shows the current path as separate line items
    #
    # SYNTAX
    # showpath [ENV_VAR]
    #
    #***************************************************************************
    **
    #

    $0 =~ s:^.*/::; # program name
    $VERSION = "1.00"; # version

    #---------------------------------------------------------------------------

    --
    # Main Routine
    #
    ShowPath: {
        if ( @ARGV ) { $VAR = $ARGV[0]; }
        else         { $VAR = "PATH";   }
        die "$0: \$$VAR not defined\n" unless ( $ENV{$VAR} );
        print "$VAR:\n";
        foreach ( split(/:/,$ENV{$VAR}) ) { print "  $_\n"; }
    } #END ShowPath
    - - - - - - - - - - snip - - - - - - - - - -
                                                                         
     Bill Thompson                                                       
     Sr UNIX Systems Administrator                                       
     The Goodyear Tire & Rubber Company                                  
     6-0599                                                              
                                                                         
     Contains Confidential and/or Proprietary Information.               
     May Not Be Copied or Disseminated Without Express Consent of The    
     Goodyear Tire & Rubber Company.                                     
                                                                         
    Brett's:
    -----Original Message-----
    From: Julius Szelagiewicz [mailto:julius@turtle.com] 
    Sent: Tuesday, December 02, 2003 10:53 AM
    To: Abramson, Stuart
    Subject: Re: [HPADM] Breaking up my $PATH into separate lines
    Stuart,
    	this is easy: echo $PATH|sed -e 's/:/\^J/g' > pathtoedit will create
    file pathtoedit that contains each element in a separate line, edit it, and
    when you are done: paste -s -d":" pathtoedit that's it. julius
    On Tue, 2 Dec 2003, Abramson, Stuart wrote:
    > Hpux-admins:
    >
    > I want to separate and sort my $PATH, which is getting way out of hand 
    > on some of our machines:
    >
    > 	# echo $PATH
    > /usr/sbin/:/usr/bin/:/usr/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin:
    > /opt/n 
    > ettladm/bin:/opt/fc/bin:/opt/fcms/bin:/opt/upgrade/bin:/opt/pd/bin:/us
    > r/bin/ 
    > X11:/usr/contrib/bin/X11:/opt/hparray/bin:/opt/resmon/bin:/opt/pred/bi
    > n:/opt 
    > /java1.2/bin:/opt/networker/bin:/opt/perf/bin:/opt/ignite/bin:/opt/hpn
    > p//bin
    >
    :/opt/graphics/common/bin:/opt/java1.2/bin:/sbin:/home/root:/usr/symcli/bin:
    >
    /usr/emc/ESN_Manager:/usr/emc/FibreZone/bin:/usr/local/bin:/home/saroot/bin:
    > /opt/perf/bin:/usr/symcli/bin:/usr/symcli64/bin/
    >
    > I seem to recall seeing some trick with:
    >
    > Either
    >
    > -	awk
    > 		awk -F":"
    > 		awk {RS=":"; print $....
    > Or
    > -	IFS
    > 		IFS=":" echo $PATH...
    >
    > Where you could break up your $PATH into "separate" variables and 
    > sort/edit them, and then put them back together.
    >
    > Can anybody help me here?
    >
    > 	Stuart
    >
    > Stuart Abramson | 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.
    --
                 ---> 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: Patel Pankaj: "[HPADM] tar cvf , tar xvf"

    Relevant Pages

    • Hp Divorce
      ... "HP's board have discussed splitting up the company on three separate ... Fiorina made the disclosure in response to a question from Merrill Lynch ... This electronic transmission, ...
      (comp.os.vms)
    • [HPADM] Summary 2: Breaking up my $PATH into separate lines
      ... Subject: Summary: Breaking up my $PATH into separate lines ... > To: Abramson, Stuart ... If the reader of this transmission ... > dissemination, distribution, or copying of this transmission is ...
      (HP-UX-Admin)
    • Re: Word X Page Numbering Will Not Restart Correctly
      ... > I'm attempting to combine two Word documents into one for purposes of ... > transmission. ... > I'd like the two documents to have separate page numbering with the ...
      (microsoft.public.mac.office.word)
    • Re: When to change brake and power steering fluid? Or never.
      ... A1 like A-131L have separate tranny and differential fluids, ... A140, A240, etc. refers to transmission series, not engine series, and it is ...
      (alt.autos.toyota)