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

From: Abramson, Stuart (SAbramson@Wabtec.com)
Date: Tue Dec 02 2003 - 12:03:56 EST


 

-----Original Message-----
From: Anil Rajapure [mailto:anil_unix1975@yahoo.com]
Sent: Tuesday, December 02, 2003 11:54 AM
To: Abramson, Stuart
Subject: Re: [HPADM] Summary: Breaking up my $PATH into separate lines

I do this.

        echo $PATH|tr ":" "\n"|pg

--- "Abramson, Stuart" <SAbramson@Wabtec.com> wrote:
> 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
=== message truncated ===

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.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.

--
             ---> 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)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:37 EDT