Changing the path

Hi ,

Iam changing the path in weblogic

from /opt/user/shared/mydomain

to

/opt/users/shared/multidomain

i have to change the below configuration files by using scripting am using for loop and sed to change the below files.

for i in ${b}startWebLogic.sh ${b}stopWebLogic.sh ${b}setDomainEnv.sh ${b}startManagedWebLogic.sh \ ${b}stopManagedWebLogic.sh ${d}Plan.xml ${b}nodemanager/wlscontrol.sh ${d}init-info/startscript.xml  \
${d}init-info/tokenValue.properties ${c}nodemanager/nodemanager.domains ${c}bin/wlscontrol.sh ${cx} \
 ${s}start.sh ${s}stop.sh 

is ther's any sample script.

Thanks,

thanks

Here is an example for you, this writes old script to *.old filename for backup purposes.

FROM="/opt/user/shared/mydomain"
TO="/opt/users/shared/multidomain"
 
for i in ${b}startWebLogic.sh ${b}stopWebLogic.sh ${b}setDomainEnv.sh ${b}startManagedWebLogic.sh   \
${b}stopManagedWebLogic.sh ${d}Plan.xml ${b}nodemanager/wlscontrol.sh ${d}init-info/startscript.xml \
${d}init-info/tokenValue.properties ${c}nodemanager/nodemanager.domains ${c}bin/wlscontrol.sh ${cx} \
${s}start.sh ${s}stop.sh
do
   if [ -f $i ]
   then
      echo $i
      sed "s:$FROM:$TO:g" $i > $i.new
      mv $i $i.old
      mv $i.new $i
   fi
done

It might also be worth considering putting the filelist into an external (data) file, rather than hardcoded into the script.