I've been using vi for about 10 years, but this is my first attempt at creating a vi script. I am reformatting some files to create CSVs for import into a database. In the script, I have a bunch of substitute lines that work fine, but I'm trying to figure out how to get the script into insert mode and then back to command mode so I can run commands such as:
d1G
dG
1G
I've tried typing <ESC> into the script, but vi doesn't seem to recognize it. What can I use to switch modes?
What I have is an HTML product catalog that has written text like product descriptions and the like and below it there is product specifications which is what I am grabbing for my database. Basically, I'm just looking to delete the first n lines of the file. However, n is dependent on wherever the written text ends. I can do it easily with vi commands in insert mode, but not command mode. I may just end up writing a macro and calling it from my script for the parts I can't do in command mode.