I'm working on a bash script that will split the contents of a text document depending on the data in the line.
If the contents of the original file were along the lines of
01 line
01 line
02 line
02 line
How can I insert into line 3 of this file using bash to result in
01 line
01 line
text to insert
02 line
02 line
I'm hoping to do this using a heredoc or something similar in my script
#!/bin/bash
vim -e -s ./file.txt <<- HEREDOC
:3 | startinsert | "text to insert\n"
:update
:quit
HEREDOC
The above doesn't work of course but any recommendations that I could implement into this bash script?