是否有可能在Linux中找到包含特定文本的文件? [英] is it possible to find the file which contains a specific text in linux?
本文介绍了是否有可能在Linux中找到包含特定文本的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑这种情况,我在示例"文件夹下有许多文件.如果我需要查找包含诸如类示例"之类的特定短语的文件,我该如何使用linux shell?
Consider this situation where i have many files under a folder "Example".And if i need to find a file which contains a specific phrase like "Class Example", how do i do it with a linux shell?
在Linux中是否有类似定位"功能的函数?
is there any "locate" like functions in linux to do this?
谢谢
巴兰
推荐答案
使用良好的语言grep
:
grep -R "Class Example" Example
其中"Class Example"
是搜索字符串,而Example
是目录,而-R
指定递归搜索.
where "Class Example"
is the search string and Example
is the directory, and -R
specifies recursive search.
这篇关于是否有可能在Linux中找到包含特定文本的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文