ack只能基于文件名查找文件吗? [英] Can ack find files based on filename only?

查看:79
本文介绍了ack只能基于文件名查找文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 ack (有时打包为ack-grep),我知道我可以找到包含特定路径的路径

ack -g somestring

Using ack (sometimes packaged as ack-grep) I know that I can find paths that contain a specific string by doing:
ack -g somestring

但是如果我只想要文件怎么办

But what if I only want files which have "somestring" in their filenames?

推荐答案

您可以使用查找实用程序。像这样的东西:

You can use find utility. Something like this:

find /path/to/look/in -name '*somestring*' -print

在某些系统上,如果省略路径,则使用当前目录。在其他系统上,您不能忽略它,只需使用代替当前目录。

On some systems, if you omit the path, current directory is used. On other systems you can't omit it, just use . for current directory instead.

此外,阅读 man find 还有许多其他选择。

Also, read man find for many other options.

这篇关于ack只能基于文件名查找文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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