Changing the path


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Changing the path
# 1  
Old 11-17-2012
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.
Code:
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
Moderator's Comments:
Mod Comment please use code tags

Last edited by jim mcnamara; 11-18-2012 at 11:48 AM..
# 2  
Old 11-18-2012
Here is an example for you, this writes old script to *.old filename for backup purposes.

Code:
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies

2. UNIX for Advanced & Expert Users

Changing single path NIC to a teamed connection in same subnet

Dear all, I have a remote CentOS7 server that has two network cards. Each card has four ports and port one of card one was defined with the IP address assigned to the server. So far, so good and it's been working for over a year. We have now got cables sorted out so there are four paths... (4 Replies)
Discussion started by: rbatte1
4 Replies

3. UNIX for Advanced & Expert Users

Command to see the logical volume path, device mapper path and its corresponding dm device path

Currently I am using this laborious command lvdisplay | awk '/LV Path/ {p=$3} /LV Name/ {n=$3} /VG Name/ {v=$3} /Block device/ {d=$3; sub(".*:", "/dev/dm-", d); printf "%s\t%s\t%s\n", p, "/dev/mapper/"v"-"n, d}' Would like to know if there is any shorter method to get this mapping of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

4. UNIX for Dummies Questions & Answers

Changing path in many files

I have many html files in a directory tree and want to change the a path declaration within the files. Files will look as below I want to remove "geopdf/" so I get as example href=../../../geo1937/geo02n01/geo0201r00010016.pdf rather than keeping the entry as ... (1 Reply)
Discussion started by: kristinu
1 Replies

5. UNIX for Dummies Questions & Answers

Changing Path Variable

Blank Blank Blank (11 Replies)
Discussion started by: pvibien
11 Replies

6. Shell Programming and Scripting

Changing the Login Path

Hi frnds! i m installing a software named 'Gamit' by using bash. bt i recieved the follwoing error: .. removing any existing Makefiles or archive files from libraries directories /root/Documents/ISP/Gamit_10.4/com/rmfresh: Permission denied. .. removing any existing Makefiles or... (1 Reply)
Discussion started by: Engr. Shoaib
1 Replies

7. Solaris

Changing of syslog file path instead of /var/log directory

Hi Please let me know how can we change the syslog file path from /var/log to /a directory in solaris Regards (4 Replies)
Discussion started by: amity
4 Replies

8. Shell Programming and Scripting

Executing Commands From Non-Standard Path (Changing user's PATH secretely???)

Hi: I have a requirement as below: I have some standard Unix commands modified and kept them in a directory say /usr/clsh/bin. For example I have a script named "ls" kept here which is modified version of "ls" (say it always gives long listing i.e. ls -l). When any user logs on and types... (2 Replies)
Discussion started by: ramesh_samane
2 Replies

9. Shell Programming and Scripting

How to change prompt color when changing path

Hi all, Can you tell me how to change the prompt color (only the path part) when I chnange directory with "cd"? I use the sequence below in ".bashrc" (Solaris 8) to change my prompt colors and I'd like to modify it to change the path color when I cange directory. PSC() { echo -ne "\"; }... (0 Replies)
Discussion started by: majormark
0 Replies

10. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies
Login or Register to Ask a Question