我如何设定一个sed用c \\新行? [英] How do I set new line with a sed using c\?
问题描述
我感觉愚蠢的,但试图在我的剧本有新生产线的多种方式。我得到的帮助乔纳森用sed命令。它的工作很好,但格式会丢失,现在我不能找到一种方法,使其工作。
I am feeling stupid but have tried multiple ways of having new line in my script. I got help from Jonathan with a sed command. It worked great but the formatting is lost and now I can't find a way to make it work.
在code是这样的:
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"
我想代替用另一个段落。但是,使用此命令的一切都印有一行。我希望它保持格式。我原来的问题就在这里:如何在文件代替一个段落
推荐答案
第一次尝试没有苏-c
。你的,
引号之间,排出的是不同的,使它更复杂了。
First try without the su -c
. Between your ""
quotes, the escaping is different and make it much more complicated.
当您完成后,无论是把结果放在一个脚本文件并调用与苏-c ./script.sh
,或调整逃逸(但是这绝不会是不错的)。
When you're done, either put the result in a script file and call that with su -c ./script.sh
, or adapt the escaping (but that's never gonna be nice).
这篇关于我如何设定一个sed用c \\新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!