这个问题似乎与 a specific programming problem, a software algorithm, or software tools primarily used by programmers 无关.如果您认为该问题将成为 another Stack Exchange site 上的主题,您可以发表评论,说明在哪里可以回答问题。
关闭5年前。
在linux中使用grep
时,结果往往会包含很多“二进制文件XXX匹配”,我不关心。如何抑制这部分结果,或者如何在grep中排除二进制文件?
最佳答案
您可以使用三个选项。 -I
是排除grep中的二进制文件。其他用于行号和文件名。
grep -I -n -H
-I -- process a binary file as if it did not contain matching data;
-n -- prefix each line of output with the 1-based line number within its input file
-H -- print the file name for each match
所以这可能是运行 grep 的一种方式:
grep -InH your-word *
https://stackoverflow.com/questions/25853722/