Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VI Gurus Phease HELP!!! 1

Status
Not open for further replies.
Feb 23, 2005
12
US
i have this statement right :

alter database rename file '/u01/app/oracle/product/9.2.0/dbs/u01oradataH89VADMO
avapp.dbf' TO '/u01/app/oracle/product/9.2.0/dbs/u01oradataH89VADMOavapp.dbf'


but i want to change and replace the line after the 'TO' with /u01/oradata/H89VADMO/avapp.dbf

so my statement should look like this after the search and replace command:

alter database rename file '/u01/app/oracle/product/9.2.0/dbs/u01oradataH89VADMO
avapp.dbf1' TO '/u01/oradata/H89VADMO/avapp.dbf'

Please what command do I use ?.
 
Try:

[tt]:%s!TO '/u01/app/oracle/product/9.2.0/dbs/u01oradataH89VADMO!TO '/u01/oradata/H89VADMO/![/tt]

(All of that should be on one line)

Annihilannic.
 
Worked like charm. Thanks!...so can please explain the meaning of the bang (!) notation and why you use it in the begining of the code (!TO) and at the end of the code (/H89VADMO/!).

thanks
 
The ! is just a string delimiter for the s(ubstitute) command, you can use whatever char you like, in the man page you'd find "s/original/replace/" examples, but seeing as your search and replace strings contain slashes (/), it is easier to use some other character...


HTH,

p5wizard
 
now i have my script but i'm missing the semi colon at the end of the statement. ...so how do i add semi colon to the end of the statement so it looks like this

alter database rename file '/u01/app/oracle/product/9.2.0/dbs/u01oradataH89VADMO
avapp.dbf1' TO '/u01/oradata/H89VADMO/avapp.dbf';
 
[tt]:%s/$/;/[/tt]

...should do it. "$" matches the end of the line.

[angel] (closest I could get to a saint)

Annihilannic.
 
A safer way (IMHO)
:%s!\([^;]\)$!\1;!

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top