我如何在其文件内容中找到包含一个特定的文本序列的所有文件?
下一个不起作用. 它似乎显示系统中的每个单一文件。
find / -type f -exec grep -H 'text-to-find-here' {} \;
我如何在其文件内容中找到包含一个特定的文本序列的所有文件?
下一个不起作用. 它似乎显示系统中的每个单一文件。
find / -type f -exec grep -H 'text-to-find-here' {} \;
当前回答
使用:
grep -c Your_Pattern *
这将报告您的模式在当前目录中的每个文件中有多少副本。
其他回答
您可以使用以下命令从文件中找到特定文本:
cat file | grep 'abc' | cut -d':' -f2
重复和案例不敏感的捕捉与线号:
grep -inr "Text" folder/to/be/searched/
下面是可以用于搜索文件的几个命令列表。
grep "text string to search” directory-path
grep [option] "text string to search” directory-path
grep -r "text string to search” directory-path
grep -r -H "text string to search” directory-path
egrep -R "word-1|word-2” directory-path
egrep -w -R "word-1|word-2” directory-path
GUI Search Alternative - 用于桌面使用:
因为问题不准确要求命令。
Searchmonkey: Advanced file search tool without having to index your system using regular expressions. 图形相当于查找/查找. 可用于 Linux (Gnome/KDE/Java) 和 Windows (Java) - 开源 GPL v3
特性:
Advanced Regular Expressions Results shown in-context Search containing text Panel to display line containing text 新 2018 更新等。
下载 - 链接:
主页: http://searchmonkey.embeddediq.com/ 下载: http://searchmonkey.embeddediq.com/index.php/download-latest Repo: https://sourceforge.net/projects/searchmonkey/files/
是
屏幕射击:
此分類上一篇
此外,请参见 The Platinium Searcher,这类似于 The Silver Searcher,并写在 Go。
例子:
pt -e 'text to search'