z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Checking as you substitute

z/OS UNIX System Services User's Guide
SA23-2279-00

What would you do now if you want to change the variable i into a k? You can't just use an instruction like
:254,267s/i/k/g
because that will change the letter i into k even in other words like int and list.
The solution to this is to add a c (for check) after the s command. For example,
:s/pattern/replacement/gc
When you do this, vi checks with you before making every substitution. Before each possible change, vi prints the line at the bottom of your screen and puts a ^ under the string that might be changed. If you want the change to happen, press the <Y> key followed by <Enter>. If you do not want the change to happen, press the <N> key followed by <Enter>.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014