bash sed:替代模式内未转义的换行符?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34576667/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 14:04:42 来源:igfitidea点击:
sed: unescaped newline inside substitute pattern?
提问by RocketNuts
This code:
这段代码:
echo Foo | sed -e 's/Foo/Bar'
results in unescaped newline inside substitute pattern
(instead of the expected Bar
).
结果unescaped newline inside substitute pattern
(而不是预期的Bar
)。
I'm obviously overlooking something simple, bash/sed/escaping related, but I can't find out what's causing this?
我显然忽略了一些简单的,bash/sed/escaping 相关的东西,但我不知道是什么导致了这个?
回答by anubhava
You are missing terminating /
:
您缺少终止/
:
echo Foo | sed -e 's/Foo/Bar/'