获取ACK通过的.htaccess或其他点文件搜索 [英] Getting ack to search through .htaccess or other dotfiles

查看:197
本文介绍了获取ACK通过的.htaccess或其他点文件搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法让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或其他点文件搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆