开发者

How do I provide Ack with the directory I want to search?

I would like to use the linux command line tool ack but there is one thing stopping me from using it and that is that I cannot figure out how to tell it where to start searching from. I would like 开发者_如何学运维to start to replace my complex find/xargs/grep commands with ack but if I cannot tell it where to start to search from I cannot use it.

For instance I am running a simulation in one directory but I would like to tell ack to search a code library from somewhere else without having to change to that directory to invoke ack.


You can provide the directory as an argument; only if you give it zero arguments past your pattern will it look in the current directory instead of where you ask it.

ack MySymbol ../src


This is in the help

>ack --help-types
or
>ack --help
Usage: ack [OPTION]... PATTERN [FILES OR DIRECTORIES]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜