grep -rn -w “The StringYou want to search” *
- means search all files in current direction
-w mean search the whole string, not string which includes the search string
本文介绍如何使用grep命令在当前目录下的所有文件中精确查找指定字符串。通过参数-r实现递归搜索,-w确保只匹配整个单词而非子串。
grep -rn -w “The StringYou want to search” *

被折叠的 条评论
为什么被折叠?