我感到很愚蠢,但尝试了多种方法在我的脚本中添加新行。我从 Jonathan 那里得到了一个 sed 命令的帮助。它工作得很好,但格式丢失了,现在我找不到让它工作的方法。
代码如下所示:
su -c "sed -i '/aStyle.Landscape {/,/}/c\
MImAbstractKeyAreaStyle.Landscape {\
/*** Label Setttings ***/\
label-margin-top: 10.6mm; /* 0.6 */\
label-margin-left-with-secondary: -1; /* not used, labels are centered horizontally */\
secondary-label-separation: 0;\
...
/*** Key Area Geometry ***/\
size: 854 -1;\
}' file.css"
我想用另一段替换一段。但是使用此命令,所有内容都打印在一行上。我希望它保持格式。我最初的问题在这里:如何替换文件中的段落?