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
Post a Comment