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

标签 linux 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.

关于linux - Centos7如何查找包含特定文本的文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45544858/

相关文章:

solr - 在 Cent os 7 上将 Apache Solr 从 4.10.4 升级到 6.6.0

java - Centos 7上使用SWT在图片上绘制文字

linux - 如何在 RHEL 7.4 上安装 gcc 4.9.2

c - 如何在c中立即启动定时器

linux - wordpress权限和安全

Python 执行 SSH 登录并做一些事情

linux - docker 容器第一次执行完成后如何自定义其卷和端口?

regex - 如何使用 sed 查找具有特定字符串的行并输出到新文件

regex - 如何在 shell 脚本中使用正则表达式从 URL 中提取字符串字段值?

memory - DF 不显示交换分区