相关疑难解决方法(0)

grep只能显示与搜索模式匹配的单词吗?

有没有办法让grep输出"单词"来自与搜索表达式匹配的文件?

如果我想在许多文件中找到所有实例,比如"th",我可以这样做:

grep "th" *
Run Code Online (Sandbox Code Playgroud)

但是输出会是这样的(粗体是我的);

some-text-file : the cat sat on the mat  
some-other-text-file : the quick brown fox  
yet-another-text-file : i hope this explains it thoroughly 

我希望它使用相同的搜索输出是:

the
the
the
this
thoroughly
Run Code Online (Sandbox Code Playgroud)

这可能使用grep吗?或者使用其他工具组合?

grep words

616
推荐指数
8
解决办法
64万
查看次数

标签 统计

grep ×1

words ×1