Hi,
I need to write a shell script (ksh) to read contents starting at a specific location from one file and append the contents at specific location in another file. Please find below the contents of the source file that I need to read the contents from,
File 1
-----
# more $ORACLE_HOME/network/admin/listener.ora
# LISTENER.ORA Configuration File:$TNSADMIN/listener.ora
#
# Notes:
# 1) Add GLOBAL_DBNAME for OMS site recognition
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 2481))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /appl/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME=i_livend_can)
(SID_NAME = inst1)
(ORACLE_HOME = /appl/oracle/product/920)
)
(SID_DESC =
(GLOBAL_DBNAME=i_archnd_can)
(SID_NAME = inst2)
(ORACLE_HOME = /appl/oracle/product/920)
)
)
Now, I need to read the contents indicated in bold from the above file and append it at a specific location in a target file. The target file is listed below
File 2
-----
# more $ORACLE_HOME/network/admin/listener.ora
# LISTENER.ORA Configuration File:$TNSADMIN/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = abcd)(PORT = 1521))
)
)
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = abcd)(PORT = 2481))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /appl/oracle/product/920)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME=inst10)
(SID_NAME = inst10)
(ORACLE_HOME = /appl/oracle/product/920)
)
(SID_DESC =
(GLOBAL_DBNAME=inst9)
(SID_NAME = inst9)
(ORACLE_HOME = /oracle/product/920)
)
(SID_DESC =
(GLOBAL_DBNAME=inst8)
(SID_NAME = inst8)
(ORACLE_HOME = /oracle/product/920)
)
(SID_DESC =
(GLOBAL_DBNAME=inst7)
(SID_NAME = inst7)
(ORACLE_HOME = /oracle/product/920)
)
(SID_DESC =
(GLOBAL_DBNAME=inst6)
(SID_NAME = inst6)
(ORACLE_HOME = /oracle/product/920)
)
(SID_DESC =
(GLOBAL_DBNAME=inst5)
(SID_NAME = inst5)
(ORACLE_HOME = /oracle/product/920)
)
(SID_DESC =
(GLOBAL_DBNAME=inst4)
(SID_NAME = inst4)
(ORACLE_HOME = /oracle/product/920)
)
here
)
The contents read from the File 1 above needs to be placed in File 2 at the location indicated by the text here.
Any help with the above is highly appreciated.
dnicky