У вас все в порядке с Python?
from __future__ import print_function
import fileinput
show = False
for line in fileinput.input('a.txt'):
if "START HERE" in line:
show = True
continue
if "END HERE" in line:
show = False
try:
input("Press ENTER to continue")
except:
pass
print(chr(27) + "[2J") # Clear screen
continue
if show:
print(line, end='')
Команда i\
принимает буквальные жесткие -закодированные символы новой строки, разделенные обратной косой чертой, а не \n
Используйте следующий шаблон, чтобы внести изменения во входной файл.
sed -i.BAK -e '
/<\/schema>/i\
<key name='\''enabled'\'' type='\''b'\''>\
<summary>Enable remote access to the desktop</summary>\
<description>\
If true, allows remote access to the desktop via the RFB\
protocol. Users on remote machines may then connect to the\
desktop using a VNC viewer.\
</description>\
<default>false</default>\
</key>
' /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml
## now do a diff between these:
diff /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml.BAK