I didn't get exactly what your script is for, but I 'll offer this suggestion which might work if you can incorporate it somewhere. The idea is to append the colon, ':' when you are extracting the Database names, and then strip off the colon, etc. parmline=`grep "^${dbname}:" ${ORATAB} export ORACLE_SID=`echo ${parmline} | cut -f 1 -d":"` I just extracted the pertinent lines for this example. I use my script to set the environment for about everything, listeners if need be, by oracle_home, agent, and oms. I am presently in the process of reworking the script to be more flexible and won't be done until after my next upgrade. Joel Patterson Database Administrator 904 727-2546 -----Original Message----- From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of Ethan Post Sent: Thursday, August 02, 2012 2:58 AM To: Herring Dave - dherri Cc: Radoulov, Dimitre; oracle-l Subject: Re: Map database to running instance from oratab? Thanks Dave. As for ksh, that is all I have ever written in besides python. On Sun, Jul 29, 2012 at 2:27 PM, Herring Dave - dherri < Dave.Herring@xxxxxxxxxx> wrote: > Ethan, > > -- //www.freelists.org/webpage/oracle-l -- //www.freelists.org/webpage/oracle-l