Grep:获取没有匹配行的所有文件 [英] Grep : get all file that doesn't have a line that matches

查看:167
本文介绍了Grep:获取没有匹配行的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多带有多行的文件,并且在大多数情况下,其中一行包含某种模式.我想列出每个没有这种模式的文件.

I have a lots of files with multiple lines, and in most case, one of the lines contain a certain pattern. I would like to list every file that does not have a line with this pattern.

推荐答案

使用"-L"选项以使文件不包含模式.根据手册页:

Use the "-L" option in order to have file WITHOUT the pattern. Per the man page:

-L,--files-without-match

-L, --files-without-match

抑制正常输出;而是打印每个输入文件的名称,通常不会从该文件中打印输出.扫描将在第一个匹配项时停止.

Suppress normal output; instead print the name of each input file from which no output would normally have been printed. The scanning will stop on the first match.

这篇关于Grep:获取没有匹配行的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆