E.g. given 1st line "what to edit" and 2nd line "what vim commands to execute"
-EEx mode: vim will treat STDIN as if it's just list of commands- here
^Emeans key press, so here 2 strategies to deal with it- replace
^Ewith new_line + ":norm " - replace
^Ewith hex code of ESC which is\x1b
- replace
head -1 > 1.tmp
vim -E 1.tmp <<EOF
:norm `sed 's/\^E/\n:norm /g'`
:wq
EOF
cat 1.tmpor print to the STDOUT instead of file
head -1>1
vim -e 1 <<<"norm `sed 's~\^E~\x1b~g'`
%p|q"- p = print