Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 如何在可执行文件中grep字符串_Bash_Grep - Fatal编程技术网

Bash 如何在可执行文件中grep字符串

Bash 如何在可执行文件中grep字符串,bash,grep,Bash,Grep,我想将文件夹中每个文件(包括可执行文件和递归文件)中的每个word。 我已经尝试了strings*| grep-Hn'word' 但它返回: (标准输入):32824:word (标准输入):84015:word 而不是: 测试:3:单词 welcome.exe:15:word ... 我知道这是因为管道将strings*返回到stdin 有人已经面对并解决了吗 编辑: 以下是我想要的结果: 测试:3:单词 welcome.exe:15:word ... 或者类似的: ---测试--

我想将文件夹中每个文件(包括可执行文件和递归文件)中的每个
word

我已经尝试了
strings*| grep-Hn'word'

但它返回:

(标准输入):32824:word
(标准输入):84015:word

而不是:

测试:3:单词
welcome.exe:15:word
...

我知道这是因为管道将
strings*
返回到
stdin

有人已经面对并解决了吗

编辑:
以下是我想要的结果:

测试:3:单词
welcome.exe:15:word
...

或者类似的:

---测试--
这是一个

---welcome.exe--
word
s是字母序列

我终于找到了它
这是
grep单词-rHna


感谢@МаъСъъъъъ
对于给定的每个文件,GNU字符串打印可打印的字符序列
,因此除非您将每个
字符串myfile
重定向到一个新文件,否则无法使用
字符串
。@mmaа@弗雷德坦蒂尼我不是说我绝对不需要字符串,你可以提出任何其他建议。我只想知道,当找到
word
时,它在哪个文件中(如果可能的话,还有一行),就像它在
grep
中所做的一样,请查看编辑