谢谢.
解决方法 只需提及文本文件的Perl -T测试,以及二进制文件的相反-B测试.$find . -type f | perl -lne 'print if -B'
将打印出它看到的任何二进制文件.如果你想要相反的文本文件,请使用-T.
它并非完全万无一失,因为它只能看到前1000个字符左右,但它比这里建议的一些特殊方法更好.请参阅man perlfunc了解整个破坏.以下是摘要:
总结The “-T” and “-B” switches work as follows. The first block or so of the file is examined to see if it is valID UTF-8 that includes non-ASCII characters. If,so it’s a “-T” file. Otherwise,that same portion of the file is examined for odd characters such as strange control codes or characters with the high bit set. If more than a third of the characters are strange,it’s a “-B” file; otherwise it’s a “-T” file. Also,any file containing a zero byte in the examined portion is consIDered a binary file.
以上是内存溢出为你收集整理的linux – 如何在目录中查找二进制文件?全部内容,希望文章能够帮你解决linux – 如何在目录中查找二进制文件?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)