相关疑难解决方法(0)

如何删除方括号和里面的任何文字?

我有一个文档,在方括号内包含一些文本,例如:

The fish [ate] the bird.
[This is some] text.
Here is a number [1001] and another [1201].
Run Code Online (Sandbox Code Playgroud)

我需要删除方括号和方括号内的所有信息,例如:

The fish  the bird.
 text.
Here is a number  and another .
Run Code Online (Sandbox Code Playgroud)
  • 我试过了sed -r 's/\[[+]\]//g' file.txt,但这没用.

如何删除模式中的任何内容[<anything>]

bash sed

2
推荐指数
1
解决办法
6928
查看次数

标签 统计

bash ×1

sed ×1