[HPADM] Matching/substituting two strings in ksh ??

From: Abramson, Stuart (SAbramson@Wabtec.com)
Date: Tue Nov 25 2003 - 14:05:26 EST


Hpux-admins:

I have two "variable strings" in a ksh script:

        OLD_MPS="/u1001 /u1101 /u1102 /u1201 . . . /uXYYY"
        NEW_MPS="/u2001 /u2101 /u2102 /u2201 . . . /uZQQQ"

I want to go through a mounted directory, and, respectively, for every
occurrence of:
        /u1001 replace it with /u2001
        /u1101 replace it with /u2101

I don't want to replace "/u1" with "/u2". I actually want to replace the
1st occurrence in the "OLD_" list with the 1st occurrence in the "NEW_"
list, the 2nd with the 2nd, the 3rd with the 3rd, etc.

My problem is not the outside loop, but the inside:

        for OMP in $OLD_MPS
        do
                echo $OMP
                # match with $NMP in $NEW_MPS

Can I turn my original variable strings into arrays? Then I could match
OLD_MPS[0] with NEW_MPS[0], etc. How would I do that?

                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.

--
             ---> 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:36 EDT