2017-08-07 327 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」 /路徑/到/目錄

相關問題