出现binary file matches是什么原因

2026年09月26日 15:16
有1个网友回答
网友(1):

  grep的时候Binary file matches 怎么解决
  操作 grep "xxx" a.log

  结果 Binary file a.log matches

  原因:grep认为a.log是二进制文件

  解决方法:grep -a "xxx" a.log

  可以看看grep -a参数的功能

  [appadmin@test3 ~/tmp]$ grep --help |grep '/-a'
  -a, --text equivalent to --binary-files=text

  即,让二进制文件等价于文本文件

  注:zgrep遇到同类问题时,解决方法是一样的