![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "sed" to check file size & echo " " to destination file | jockey007 | Shell Programming and Scripting | 7 | 04-28-2009 03:08 AM |
| search excat string in another string (grep "fails") | bora99 | UNIX for Dummies Questions & Answers | 0 | 06-05-2008 07:41 AM |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 03:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 04:15 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Appending string to xml file using "sed"
Hi folks, Following a section in opmn.xml file: Code:
</process-type>
<process-type id="OC4J_RiGHTv_IRD1" module-id="OC4J">
<environment>
<variable id="LD_LIBRARY_PATH" value="/home/ias/v10.1.2/lib" append="true"/>
<variable id="SHLIB_PATH" value="/home/ias/v10.1.2/lib32" append="true"/>
</environment>
I need to find the line <process-type id="OC4J_RiGHTv_<SCHEMA_NAME> Under this line find the line "<variable id="LD_LIBRARY_PATH .........." and appending under this line : <variable id="LD_LIBRARY_PATH" value="${ORACLE_HOME}/j2ee/OC4J_RiGHTv_${SCHEMA_NAME}/orca-3rd-lib" append="true"/> The requested result should be : ORACLE_HOME=/home/ias/v10.1.2 SCHEMA_NAME=IRD1 Code:
</process-type>
<process-type id="OC4J_RiGHTv_IRD1" module-id="OC4J">
<environment>
<variable id="LD_LIBRARY_PATH" value="/home/ias/v10.1.2/lib" append="true"/>
<variable id="LD_LIBRARY_PATH" value="/home/ias/v10.1.2/j2ee/OC4J_RiGHTv_IRD1/orca-3rd-lib" append="true"/>
<variable id="SHLIB_PATH" value="/home/ias/v10.1.2/lib32" append="true"/>
</environment>
I wrote the following function: Code:
update_opmn_xml()
{
opmnXml=/tmp/opmn.xml
export SCHEMA_NAME=IRD1
export ORACLE_HOME=/home/ias/v10.1.2
echo "<variable id=\"LD_LIBRARY_PATH\" value=\"${ORACLE_HOME}/j2ee/OC4J_RiGHTv_IRD1/orca-3rd-lib\" append=\"true\"/>" > /tmp/append_str.lst
sed -e '/process-type id="'"OC4J_RiGHTv_${SCHEMA_NAME}"'"/,/variable id=\"LD_LIBRARY_PATH\"/r /tmp/append_str.lst' ${opmnXml} > ${opmnXml}.new
mv ${opmnXml}.new ${opmnXml}
chown ias:oinstall ${opmnXml}
}
I run the function and the final result was not as I needed: Code:
</process-type>
<process-type id="OC4J_RiGHTv_IRD1" module-id="OC4J">
<variable id="LD_LIBRARY_PATH" value="/home/ias/v10.1.2/j2ee/OC4J_RiGHTv_IRD1/orca-3rd-lib" append="true"/>
<environment>
<variable id="LD_LIBRARY_PATH" value="/home/ias/v10.1.2/j2ee/OC4J_RiGHTv_IRD1/orca-3rd-lib" append="true"/>
<variable id="LD_LIBRARY_PATH" value="/home/ias/v10.1.2/lib" append="true"/>
<variable id="LD_LIBRARY_PATH" value="/home/ias/v10.1.2/j2ee/OC4J_RiGHTv_IRD1/orca-3rd-lib" append="true"/>
<variable id="SHLIB_PATH" value="/home/ias/v10.1.2/lib32" append="true"/>
</environment>
What is my mistake in the function update_opmn_xml? Thanks in advance, Nir |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|