mrmagoo_83
2[H]4U
- Joined
- Aug 8, 2002
- Messages
- 3,068
Hi, I was wondering is there a way to write a script such that it VIs a file, replaces a given string then saves it?
The issue I am having is that I can get the script to VI and replace the set string, but I cannot figure out how to code the ESCAPE command. Because once I use the R command, I am stuck in Replace mode, and cannot get out.
I am very new to this type of thing, and the script is extremely simple.
Ex:
And thats as far as it gets, well actually it does, it just adds ZZ to the PC2 so it appears PC2
ZZ
Instead of PC2 then saving and exiting.
Anyone help me out?
The issue I am having is that I can get the script to VI and replace the set string, but I cannot figure out how to code the ESCAPE command. Because once I use the R command, I am stuck in Replace mode, and cannot get out.
I am very new to this type of thing, and the script is extremely simple.
Ex:
Code:
vi /etc/hosts
/PC1
RPC2
ZZ
And thats as far as it gets, well actually it does, it just adds ZZ to the PC2 so it appears PC2
ZZ
Instead of PC2 then saving and exiting.
Anyone help me out?