2017-08-07 326 views
0

我有一个运行在centos 7上的服务器。我需要找到一个包含0774386850的文件,以便我可以用另一个字符串替换。请给我一个Linux命令给我这个文件如何在Centos7中查找包含特定文本的文件?

+0

可能重复[我要如何找到包含特定文本的所有文件在Linux上?](https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux) – dlmeetei

+0

你在你的问题中把某人的手机号码? ... – Attie

回答

0

使用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. 
0

您可以使用的grep/fgrep一样找到,以实现自己的目标。

+0

find/path/to/files -type f -exec sed -i's/oldstring/new string/g'{} \; – tibetty

0

的grep -r“0774386850” /路径/到/目录

相关问题