【问题标题】:How to change word after match?匹配后如何更改单词?
【发布时间】:2014-03-07 12:47:29
【问题描述】:

我想在匹配后删除单词:

我想更改以下行:

Assertion failed: FILE: ../../test.cpp LINE: 350: error message:

到这里:

Assertion failed: FILE: ../../test.cpp LINE: error message:

【问题讨论】:

  • 只是去掉LINE后面的数字吗?
  • 你已经尝试了什么但失败了?

标签: bash shell sed


【解决方案1】:

怎么样:

$ echo "Assertion failed: FILE: ../../test.cpp LINE: 350: error message:" \
   | sed 's/LINE: [^ ]*/LINE:/'
Assertion failed: FILE: ../../test.cpp LINE: error message:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-21
    • 2019-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多