how do i read the file
# *:/apps/oracle/product/8.1.6ctmdev01:N
# *:/apps/oracle/product/8.1.6ctmdev01:N
QBIP:/apps/oracle/product/8.1.6qbip01:Y
QBID:/apps/oracle/product/8.1.6qbid01:Y
QBIT:/apps/oracle/product/8.1.6qbit01:Y
and read
QBIP
QBID
QBIT
into Oracle_value variable and pass that variable into my shell script?? the purpose is to run that 1 script on 3 instances??
in this cut will isolate the first column in all lines using : as separator and [A-Z]+ in grep ensures that you dont read the columns having # etc and sed replace newlines with spaces.
If you want a loop in which you can pass the content of whole lines having QBIP etc. You may try this..
while i in `grep '^[A-Z]+:.*$' /etc/oratab`
do
echo $i
done
this will echo only those lines beginning with all caps and ending with a : . So effectively isolating those lines containing QBIP etc.