[vim ] 刪除含有某單字的行

看板Editor作者 (Code Warrior)時間12年前 (2012/05/04 01:15), 編輯推噓1(103)
留言4則, 3人參與, 最新討論串1/1
VIM新手 想請問有沒有什麼Command可以把整份文件含有某個單字的行數刪掉? EX: cat cow dog fish cat cow dog dog fish cat cat cat 把含有dog的行數刪掉變成 fish cat cow cat cat cat -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.43.99.110

05/04 01:21, , 1F
:g/\<dog\>/d
05/04 01:21, 1F

05/04 14:23, , 2F
感謝解答!!!
05/04 14:23, 2F

05/05 18:35, , 3F
:%s/.*\<dog\>.*\n//g
05/05 18:35, 3F

05/05 18:35, , 4F
:%!grep -wv dog
05/05 18:35, 4F
文章代碼(AID): #1FehqN6r (Editor)