Hi I have a CommonTemplateStop.template file . Inside the file i need to replace the variables DepName and CompInsName with the values(Trade and TradeIns) specified in the script. I have written the below .sh script in linux server which will read the .template file and has to replace the 2 parameters DepName and CompInsName with the values specified in the script .When i call the script below i get the below error:
sed: -e expression #1, char 9: missing command
sed: -e expression #1, char 13: missing command
Am quite a novice in unix scripting. Any help is appreciated.
#!/bin/bash
DepName=Trade
CompInsName=TradeIns
templatefile=/tmp/sam/CommonTemplateStop.template
cat $templatefile|sed -e "/DepName/"
cat $templatefile|sed -e "/CompInsName/"
Template file given below :
<?xml version="1.0" encoding="UTF-8" ?>
<ruleBase>
<version>4.6.0</version>
<name><![CDATA[CommonTemplateStop]]></name>
<schedule></schedule>
<author>sdutta on host SDuttaDT(192.168.112.134) at 15:49 Wed, Jul 29, 2015</author>
<lastModification>sdutta on host SDuttaDT(192.168.112.134) at 11:46 Tue, Aug 11, 2015</lastModification>
<comment><![CDATA[]]></comment>
<rule>
<name><![CDATA[COM.TIBCO.admin.TRA:getComponentInstanceStatus(Component Instance=${External.CompInsName}, Deployment=${External.DepName}):15]]></name>
<schedule>AlertWindow</schedule>
<overRuling>0</overRuling>
<dataSource>
<microAgentName><![CDATA[COM.TIBCO.admin.TRA]]></microAgentName>
<methodName>getComponentInstanceStatus</methodName>
<dataElement name="Deployment">
<dataObject class="java.lang.String" ><![CDATA[${External.DepName}]]></dataObject>
</dataElement>
<dataElement name="Component Instance">
<dataObject class="java.lang.String" ><![CDATA[${External.CompInsName}]]></dataObject>
</dataElement>
<interval>15000</interval>
</dataSource>
</rule>
</rulebase>