加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 如何查找不包含给定搜索字符串的文件

发布时间:2020-12-14 02:31:11 所属栏目:Linux 来源:网络整理
导读:我有一个命令,可以找到包含字符串“Font”的所有PDF文件 find /Users/me/PDFFiles/ -type f -name "*.pdf" -exec grep -H 'Font' '{}' ';' 如何更改此命令以使其反转?查找不包含搜索字符串“Font”的所有PDF文件 解决方法 你想使用grep的“-L”选项: -L,--
我有一个命令,可以找到包含字符串“Font”的所有PDF文件
find /Users/me/PDFFiles/  -type f -name "*.pdf" -exec grep -H 'Font' '{}' ';'

如何更改此命令以使其反转?查找不包含搜索字符串“Font”的所有PDF文件

解决方法

你想使用grep的“-L”选项:
-L,--files-without-match
         Only the names of files not containing selected lines are written to standard output.  Path-
         names are listed once per file searched.  If the standard input is searched,the string
         ``(standard input)'' is written.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读