013231
V2EX  ›  Vim

Vim中怎样把不能与指定正则表达式匹配的行都删掉?

  •  
  •   013231 · Jan 13, 2012 · 5423 views
    This topic created in 5252 days ago, the information mentioned may be changed or developed.
    对于文件的每一行, 如果可以和指定正则表达式匹配就保留, 否则就删除. 也就是说相当于grep过滤的效果. 在Vim中应该怎么做呢?
    2 replies    1970-01-01 08:00:00 +08:00
    Vim
        1
    Vim  
       Jan 13, 2012
    :v/pattern/d
    或者
    :g!/pattern/d
    mybeky
        2
    mybeky  
       Jan 13, 2012
    :v/PATTERN/d
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5941 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 73ms · UTC 01:55 · PVG 09:55 · LAX 18:55 · JFK 21:55
    ♥ Do have faith in what you're doing.