command line - How to write bash script to open vi and edit document? - Ask Ubuntu


i'd write bash script automates process:

vi filename.pdf (open "filename.pdf" using vi)

:4,7d (in vi command mode, delete lines 4-7)

o (in vi command mode, tap shift+o (captial oh) create new line)

<<>> (in vi insert mode, type 2 lesser-thans , 2 greater-thans)

esc (switch vi command mode)

:wq (in vi command mode, save file , quit vi)

echo "complete."

you might want use ed (which designed automate scripting)

ed < edit.sed filename.pdf 

where edit.sed is:

4,7d <<>> . w q 

this insert <<>> in fifth line.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User