grep的时候Binary file (standard input) 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

二进制文件等价于文本文件

猜你喜欢

转载自aoyouzi.iteye.com/blog/2024246