【发布时间】:2014-06-27 09:40:36
【问题描述】:
我正在尝试使用 sed(CentOS 上的 shell 脚本的一部分)删除 HTML 文件中括号后的尾随空格:
从此:
<p>Some text (
<em>Text which should not break to a new line</em>). More text.</p>
到这里:
<p>Some text (<em>Text which should not break to a new line</em>). More text.</p>
我可以在 Sublime Text 中使用 \(\s REGEX 轻松完成,并用括号替换它,但这在 sed 中不起作用。
我试过了:
sed 's/[(]\s*$/(/'
sed 's/[(]\s*$\n/(/'
还有很多其他的东西,但它们都不起作用。
有什么想法吗?
【问题讨论】:
-
你的意思是删除换行符吗?