简体   繁体   中英

Linux Vim delete lines that don't contain abc or xyz

In Vim there is :v for excluding lines for a delete

:v/abc/d

to delete all lines that do not have abc in them. Which is fine but what if I want to delete everything that doesn't contain abc OR xyz?

您可以这样做:

:v/\(abc\)\|\(xyz\)/d

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM