我如何在其文件内容中找到包含一个特定的文本序列的所有文件?
下一个不起作用. 它似乎显示系统中的每个单一文件。
find / -type f -exec grep -H 'text-to-find-here' {} \;
我如何在其文件内容中找到包含一个特定的文本序列的所有文件?
下一个不起作用. 它似乎显示系统中的每个单一文件。
find / -type f -exec grep -H 'text-to-find-here' {} \;
当前回答
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/
是
屏幕射击:
此分類上一篇
其他回答
按要求轻松自定义下面的命令,并从文件中重复找到任何行。
grep -i hack $(find /etc/ -type f)
重复和案例不敏感的捕捉与线号:
grep -inr "Text" folder/to/be/searched/
你的命令是正确的. 你只需要添加 -l 来抓住:
find / -type f -exec grep -l 'text-to-find-here' {} \;
避免混乱并安装 ack-grep. 它消除了许多许可和引用问题。
apt-get install ack-grep
然后转到您想要搜索的目录,并运行下面的命令。
cd /
ack-grep "find my keyword"
您可以使用以下命令从文件中找到特定文本:
cat file | grep 'abc' | cut -d':' -f2