如何删除多个以 [ 开头并以 ] 结尾的单词

Shu*_*aha 2 vim

我有一个文件 subdomains.txt。我想从文件数据中删除一些单词。

[Sublist3rAPI]    andrei2.markelow.example.com
[Sublist3rAPI]    tema-x.example.com
[ThreatCrowd]     fireeye-testevent.example.com
[ThreatCrowd]     certs.example.com
[Google]     swat.example.com
[Google]     apps.example.com
Run Code Online (Sandbox Code Playgroud)

andrei2.markelow.example.com
tema-x.example.com
fireeye-testevent.example.com
certs.example.com
swat.example.com
apps.example.com
Run Code Online (Sandbox Code Playgroud)

Ser*_*ujo 5

使用命令模式“正常”

:%norm dW
Run Code Online (Sandbox Code Playgroud)

它应用一个普通命令dW,删除整个文件的“大字” %

或者我们可以通过 awk 过滤当前文件

:%!awk '{print $2}'
Run Code Online (Sandbox Code Playgroud)