How to remove multiple words start with [ and end with ]

Viewed 83

I have a file subdomains.txt. I want to remove some words from file data.

[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

To

andrei2.markelow.example.com
tema-x.example.com
fireeye-testevent.example.com
certs.example.com
swat.example.com
apps.example.com
2 Answers

Using command mode "normal"

:%norm dW

It applies a normal command dW, delete "big word" for the whole file %.

or we can filter the current file through awk

:%!awk '{print $2}'

I would use

:%s/^\[\w\+]\s*/

or

:%s/^\[[^]]\+]\s*/
Related