3 ms·
A cool little feature to vi also is the inclusion of sed-like commands... :%s/someword/some-other-word/g is a valid command to exchange the words throughout y
by TheCapn 15y ago
A cool little feature to vi also is the inclusion of sed-like commands...
:%s/someword/some-other-word/g
is a valid command to exchange the words throughout your current file in the same way you would with sed.
Also to note is that the use of '/' is not required explicitly. You'll often end up building fences when you have to terminate a lot of characters when you're working with paths in commands like:
s/\/usr\/opt\/dir\//\/var\/opt\/dir\//g
Instead you could pick a different terminating character and simplify it for easier reading:
s_/usr/opt/dir/_/var/opt/dir/_g