find . -type f | xargs file | grep text | cut -d':' -f1 | xargs grep -l "TEXTSEARCH" {}
您可以在grep中使用-r(递归)和-I(忽略二进制)选项:
原文链接:https://www.f2er.com/bash/390310.html$ grep -rI "TEXTSEARCH" .
-I
Process a binary file as if it did not contain matching data; this is equivalent to the--binary-files=without-match
option.-r
Read all files under each directory,recursively; this is equivalent to the-d recurse
option.