我有一个命令,查找所有包含string“Font”的PDF文件
find /Users/me/PDFFiles/ -type f -name "*.pdf" -exec grep -H 'Font' '{}' ';'
我怎样才能改变这个命令,使之反转? 查找不包含searchstring“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.
只需添加“L”标志。 这是相反的
find /Users/me/PDFFiles/ -type f -name "*.pdf" -exec grep -HL 'Font' '{}' ';'