问题描述
有没有什么办法让ACK通过一个文件,其文件名开头来搜索。
(如htaccess的),而不诉诸 - 所有
或 - 无限制
选项
我尝试添加以下到我的〜/ .ackrc
文件无济于事:
- 类型设置=阿帕奇=的.htaccess
这样看来,ACK无法识别的文件名是所有的扩展;也就是说,当你指定的.htaccess的延伸,ACK只查找与该扩展名前至少一个字符的文件。
要解决这个问题,你可以使用 -u / - 无限制
与组合 -G正则表达式
标志(以限制搜索到的文件名匹配一个正则表达式)。例如:
$ ACK -u -G'\的.htaccess'模式
Is there any way to get ack to search through a file whose filename starts with a .
(e.g. .htaccess), without resorting to the --all
or --unrestricted
options?
I've tried adding the following to my ~/.ackrc
file to no avail:
--type-set=apache=.htaccess
It would appear that ack doesn't recognize a filename that's all extension; that is, when you specify an extension of ".htaccess", ack only looks for files with at least one character before that extension.
To get around this, you can use -u/--unrestricted
in combination with the -G regex
flag (to restrict the search to files whose names match a regex). For example:
$ ack -u -G '\.htaccess' pattern
这篇关于获取ACK通过的.htaccess或其他点文件搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!