Centos7如何查找包含特定文本的文件?

How to find a file containing specific text in Centos7?

我有一台在 centos 7 上运行的服务器。我需要找到一个包含 0774386850 的文件,以便我可以用另一个字符串替换。请给我一个 Linux 命令给我那个文件

您可以使用 grep/fgrepfind 来实现您的目标。

通过使用grep命令,你可以达到你的预期

grep -rlnw '/path/to/somewhere/' -e '0774386850'
-r or -R is recursive,
-n is line number, and
-w stands for match the whole word.
-l (lower-case L) file name of matching files.

grep -r "0774386850" /path/to/dir