【发布时间】:2015-10-03 22:42:09
【问题描述】:
如何在不删除换行符的情况下找到可能被换行符分割的多个单词?
例如
The promotion and merchandise aided the success of We Are
the World and raised over $63 million for humanitarian
aid in Africa and the US.
使用 sed(或任何 *nix 文本处理工具,例如 awk、perl)搜索 We Are the World 并将其替换为例如<song title> 所以它显示为:
The promotion and merchandise aided the success of <song title>
and raised over $63 million for humanitarian
aid in Africa and the US.
我有一堆搜索模式(歌曲标题),我想搜索文本片段并将它们全部替换为 <song title>。我不想删除换行符。
【问题讨论】: