相关疑难解决方法(0)

用sed替换等长的文本

有没有办法用sed替换等长的其他东西(例如点,零等)的模式?像这样:

maci:/ san$ echo "She sells sea shells by the sea shore" | sed 's/\(sh[a-z]*\)/../gI'
.. sells sea .. by the sea ..
Run Code Online (Sandbox Code Playgroud)

("我"需要更新版本的sed来忽略大小写)
这很简单:以"sh"开头的单词被双点(..)替换但是如何使它成为这样的东西:... sells sea ...... by the sea .....

任何的想法?干杯!

regex linux bash sed

6
推荐指数
4
解决办法
3811
查看次数

标签 统计

bash ×1

linux ×1

regex ×1

sed ×1