How to replace, add word or information in a file with vi editor
If you need to add a new server for example after test and it is called energia
# vi test
Argentina rock=test,energia
Venezuela rock=test,energia,test1
Colombia rock=test,energia,test1,test2
~
~
:%s/rock=test/rock=test,energia/g
Or if you want to replace root for another word for example rock
Argentina root=test,energia
Venezuela root=test,energia,test1
Colombia root=test,energia,test1,test2
~
~
~
~
:%s/root/rock/g
You have other form to do it, however it is the simple way to perform some change in any files, for example /etc/dfs/dfstab or in the vfstab when you need to change a specific word in any file
Regards
Roger
Comments