【发布时间】:2014-01-02 01:43:28
【问题描述】:
我已经构建了一个 grep 命令,用于在文件目录中递归搜索其中的模式。问题是 grep 只返回模式所在的文件名,而不是模式的完全匹配。如何返回实际结果?
例子:
文件somefile.bin 包含somestring0987654321�123�45� 与一百万个其他文件的目录
命令:
$ grep -EsniR -A 1 -B 1 '([a-zA-Z0-9]+)\x00([0-9]+)\x00([0-9]+)\x00' *
当前结果:
Binary file somefile.bin matches
想要的结果(或接近):
Binary file somefile.bin matches
<line above match>
somestring0987654321�123�45�
<line below match>
【问题讨论】: