Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用rg(或替代方法ag)在包含许多文件的文件夹中搜索字符串的出现,如下所示:
rg
ag
$ rg "cat" lolo 3:cat lala 2:cat
现在我想摆脱这些比赛。
如何从每个具有匹配项的文件中删除包含匹配项的每一行?
它的rg -v 'pattern'. 和 grep 一样
rg -v 'pattern'
使用-v参数,例如:
-v
rg -v "cat" test.log
结果
1:lolo 3: 4:lala