且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Bash:如何在osx bash中用新行替换字符串?

更新时间:2022-02-23 07:55:42

此处正在使用sed

echo "Replace <newLine> it by <newLine> NEWLINE <newLine> in my OSX terminal <newLine> and bash script" | sed 's/<newLine>/\'$'\n/g'

这是一篇博客文章,解释了为什么-https://nlfiedler.github.io/2010/12/05/newlines-in-sed-on-mac.html

And here is a blogpost explaining why - https://nlfiedler.github.io/2010/12/05/newlines-in-sed-on-mac.html