简体   繁体   English

源代码中的Grep,不包括构建文件夹

[英]Grep on source code excluding build folders

I use grep to look for a variable usage or a function call in the following way 我使用grep通过以下方式查找变量用法或函数调用

 grep -Rni <function_name>

However, the search also includes my build and build_debug folders. 但是,搜索还包括我的build和build_debug文件夹。 Considering the case in which my code is structured as following 考虑到我的代码的结构如下

root/
  | 
  ->build
  | 
  ->build_debug
  |
  ->pkg_1
     |
     ->src
     |
     ->include
  ->pkg_2
     |
     ->src
     |
     ->include

How can I modify the query so that it does not look into build and build_debug? 如何修改查询,以免查询到build和build_debug? Thanks! 谢谢!

grep --exclude-dir build --exclude-dir build_debug -Rni

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM