繁体   English   中英

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

[英]How to find a file containing specific text in Centos7?

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

通过使用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 / fgrep找到实现目标的方法。

grep -r“ 0774386850” / path / to / dir

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM