HOW TO REPLACE STRING WITH FORWARD SLASH IN VI EDITOR LINUX

My requirement is to replace the below string to another new string from ‘+DATA’ in vi editor

set newname for datafile 2 to +DATA/ORCL/DATAFILE/system.265 ;
set newname for datafile 1 to +DATA/ORCL/DATAFILE/system.257.1031501823 ;
set newname for datafile 3 to +DATA/ORCL/DATAFILE/sysaux.256.1031501729 ;
set newname for datafile 4 to +DATA/ORCL/DATAFILE/undotbs1.259.1031501899 ;
set newname for datafile 8 to +DATA/ORCL/DATAFILE/users.274.1040915137 ;
set newname for datafile 7 to +DATA/ORCL/DATAFILE/users.272.1040745563 ;
set newname for datafile 6 to +DATA/ORCL/users.new ;
set newname for datafile 5 to +DATA/ORCL/DATAFILE/example.265.1031501993 ;
set newname for datafile 9 to /home/oracle/rcat.tbs ;
set newname for tempfile 1 to +DATA/ORCL/TEMPFILE/temp.264.1031501981 ;

Press esc in keyboard and colon and use ‘#’ as a separator between old and new strings

:%s#+DATA/ORCL/DATAFILE#/u01/app/oradata#g

There you are !

set newname for datafile 2 to /u01/app/oradata/system.265 ;
set newname for datafile 1 to /u01/app/oradata/system.257.1031501823 ;
set newname for datafile 3 to /u01/app/oradata/sysaux.256.1031501729 ;
set newname for datafile 4 to /u01/app/oradata/undotbs1.259.1031501899 ;
set newname for datafile 8 to /u01/app/oradata/users.274.1040915137 ;
set newname for datafile 7 to /u01/app/oradata/users.272.1040745563 ;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s