假设我有一条短信:
"this\n is >\n<"
我想用 none 替换换行符,这将导致:
"this\n is ><"
如何实现这一目标?
我尝试使用以下内容:
echo "this\n is >\n<" | sed -e 's/>\n<//g'
但是没有成功。任何帮助将不胜感激。
最佳答案
使用 \
转义 \
:
echo "this\n is >\n<" | sed -e 's/>\\n</></g'
输出:
this\n is ><
关于linux - 如何在unix中仅替换>和<之间的一个换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38422453/