I'd like to write a Bash script that essentially automates the following process:
Open the
filename.pdf
file withvi
:vi filename.pdf
In
vi
command mode, delete lines 4-7::4,7d
In
vi
command mode, tap Shift+O (capital oh) to create a new line:O
In
vi
insert mode, type two lesser-thans and two greater-thans:<<>>
Switch
vi
to command mode:ESC
In
vi
command mode, save file and quitvi
::wq
Run:
echo "Complete."
you might want to use
ed
(which is designed to automate scripting):where
edit.sed
is:This will insert
<<>>
in the fifth line.