Hi my code is as follow:
stringA=`cat /s01/oracle/11.2/network/admin/listener.ora | grep "PORT"`
stringB=`cat $ORACLE_HOME/network/admin/listener.ora | grep "PORT"`
stringC="PORT"
echo ${stringA}
echo ${stringB}
echo ${stringC}
position=`expr index "$stringB" "stringC"`
echo ${position}
output is as follow
(DESCRIPTION_LIST =(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SG-RH5.3-64)(PORT=1522)))
(DESCRIPTION_LIST =(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=SG-RH5.3-64)(PORT=1522)))
PORT
7
But unfortunately I don't understand why position 7 is return and if position 7 is returned, I definitely cannot extract 1522 as port number, i.e. $port_number=1522
I'm running on Redhat 5.3
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
thanks