在文件中递归查找字符串/正则表达式匹配的最佳方法是什么?(UNIX) [英] What's the best way to find a string/regex match in files recursively? (UNIX)
本文介绍了在文件中递归查找字符串/正则表达式匹配的最佳方法是什么?(UNIX)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不得不多次这样做,通常是在尝试查找在哪些文件中使用了变量或函数时.
I have had to do this several times, usually when trying to find in what files a variable or a function is used.
我记得过去使用 xargs 和 grep 来做到这一点,但我想知道是否有更简单的方法.
I remember using xargs with grep in the past to do this, but I am wondering if there are any easier ways.
推荐答案
grep -r REGEX .
将 .
替换为您要搜索的任何目录.
Replace .
with whatever directory you want to search from.
这篇关于在文件中递归查找字符串/正则表达式匹配的最佳方法是什么?(UNIX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文