有哪些实用程序可以在许多文件或文件夹中搜索代码?

发布于 2024-07-15 22:05:33 字数 1539 浏览 7 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

何时共饮酒 2024-07-22 22:05:33

在 Windows 上,有一个类似于 grep 的“find”命令。

您还可以下载 cygwin 或其他一些 Unix 模拟器并从中获取 grep。

在 Windows 上,您还可以使用“unxutils”包获取独立版本的 grep: http://unxutils.sourceforge.net /

On Windows, there's a "find" command that is similar to grep.

You could also download cygwin or some other Unix emulator and get grep from that.

On Windows, you can also get a standalone version of grep with "unxutils" pack: http://unxutils.sourceforge.net/

梦魇绽荼蘼 2024-07-22 22:05:33

对于 Windows,我过去曾使用过 Agent Ransack,效果非常好。

For Windows I've used Agent Ransack before in the past and it's done a pretty good job.

春夜浅 2024-07-22 22:05:33

我为此使用 Notepad++。 它甚至有正则表达式支持。

搜索->在文件中搜索

I use Notepad++ for this. It even has regex support.

Search->Search in files

那些过往 2024-07-22 22:05:33

Textpad 是一个非常有用且便宜的编辑器,具有非常好的跨目录搜索功能。
它甚至允许您快速转到搜索结果中提到的每个文件/行,只需重复按 F4 即可。

Textpad is a very useful - and cheap - editor that has very good cross-directory searches.
It even allows you to quickly go to each of files/lines mentioned in the search results, just by pressing F4 repeatedly.

葬心 2024-07-22 22:05:33

Eclipse 功能强大而且免费。 Ctrl + Alt + H 将搜索 Eclipse 支持的任何语言的方法、声明、类型或自由文本。 您甚至可以使用通配符和正则表达式。

例如,我一直在努力寻找某种方法的所有访问权限。 Eclipse 再次为我做得很好:Ctrl + H 将打开 Call Hierarchy 视图。

Eclipse is powerful and is free. Ctrl + Alt + H will search for methods, declarations, types or just free text in any language Eclipse supports. You can even use wildcards and regex.

I've been struggling with finding all the access to some method, for example. Once again, Eclipse does it for me very well: Ctrl + H will open the Call Hierarchy view.

最佳男配角 2024-07-22 22:05:33

确认 提供与 grep 相同的选项,其目的是在源代码中搜索、跳过临时文件和二进制文件、核心转储。 它是一个 Perl 脚本,因此可以在 Unix 和 Windows 系统上运行。

Ack provides the same options as grep does, it is aimed at searching in source code, skipping temporary and binary files, core dump. It's a Perl script so can run on Unixes and Windows systems.

东京女 2024-07-22 22:05:33

由于您似乎使用的是 Windows,Google 告诉我您实际上可以使用 DOS 命令行:

在文件中递归查找文本字符串,输出行号:

FOR /R c:~kenneth %v IN (*.css) DO find /N /I "#banner" "%~fv" >>> 测试.txt

注意%v是一个变量,可以是任何字母。 引用的“%~fv”展开
到引用的完全限定路径名。 不带引号的目录
空格不被处理。

*.css 可以是任何通配符,甚至可以是 *。
>> 将输出连接到一个文件,在本例中为 test.txt。

在此处查找更多示例: http:// /kennethhunt.com/archives/000173.html

Since it seems that you're on Windows, Google tells me you can actually use the DOS cmd line:

Recursive Find Text String In Files, Output Line Number:

FOR /R c:~kenneth %v IN (*.css) DO find /N /I "#banner" "%~fv" >> test.txt

Note the %v is a variable, could be any letter. The quoted "%~fv" expands
to the quoted fully qualified pathname. With out quotes Directories with
spaces are not processed.

*.css could be any wildcard or even * for all.
the >> concatenates the output to one file, in this case test.txt.

Find more examples here: http://kennethhunt.com/archives/000173.html

煞人兵器 2024-07-22 22:05:33

如果是在 Mac 上,TextWrangler 非常适合使用 grep 进行多文件搜索。

If it's on a Mac, TextWrangler is rather fantastic for multi-file search with grep.

饮湿 2024-07-22 22:05:33

我还没有见过 PowerGrep,但 Visual Studio 的“在文件中查找”最适合我。 还允许“在文件中替换”并打开更改的文件以启用撤消。

I have not seen PowerGrep but Visual Studio's "Find in files" works best for me. Also allows "Replace in files" and opens changed files to enable undo.

小情绪 2024-07-22 22:05:33

在最新版本的 Windows 上,findstr.exe 将为您提供良好的服务,它比 find.exe 具有更多功能。

<块引用>

findstr /nips /c:"唯一文本字符串" *.txt

它不像 grep 那样强大,但它可以工作。 /n 给出行号,/m 只给出文件名。

如果您忘记了文件规范,它只会等待终止。

我还建议学习 cmd shell 脚本。 以“为了/?”开头。

On recent versions of Windows you'll be well served with findstr.exe which has more features than find.exe.

findstr /nips /c:"unique text string" *.txt

It's not as powerful as grep but it works. The /n gives you line numbers, /m will just give you filenames.

If you forget the file spec it will just wait around for termination.

I'd also recommend learning cmd shell scripting. Start with "for /?".

泼猴你往哪里跑 2024-07-22 22:05:33

我知道您要求免费软件,但如果其他人正在浏览这个问题,我建议您查看 洗脱液查找。 我几年前买的,每天都用。 我为不同类型的搜索设置了很多路径计划和扩展配置。

它有点老化,似乎没有升级,但它的工作原理如广告所示,不确定他们会添加什么。 每年左右我都会四处查看竞争对手,但没有发现任何更适合我的东西。 路径规划是关键特征。

20 美元。

I know you're asking for freeware, but in case anyone else is browsing this question, I'd recommend a look at Eluent Find. I bought this years ago, and use it daily. I have lots of path plans and extension configs set up for different types of searches I do.

It's aging a bit, doesn't seem to be getting upgraded, but it works as advertised, not sure what they'd add to it. Every year or so I look around around to check the competition, and haven't found anything that works better for me. The path plans are the key feature.

$20.

桃扇骨 2024-07-22 22:05:33

如果您安装 cygwin,您将获得 findgrep 实用程序,它们可以像这样一起使用:

find <dir> -name '*.cpp' -exec grep -H <pattern> {} \;

或者简单地递归 grep,如果您不关心过滤文件扩展名:

grep -R <pattern> <dir>

If you install cygwin, you get the find and grep utilities, which can be used in concert like so:

find <dir> -name '*.cpp' -exec grep -H <pattern> {} \;

Or simply recursive grep, if you don't care about filtering by file-extension:

grep -R <pattern> <dir>
童话里做英雄 2024-07-22 22:05:33

Google 桌面。 一旦它对您的文件建立了索引,就可以非常快速地在所有文件(代码或其他文件)中进行搜索。 您还可以按文件类型搜索。

如果您使用的是 Windows XP,我不推荐 Windows Live Search; 它又慢又笨重。

Google Desktop. Once it's indexed your files, it's very fast for searching for and within all your files - code or otherwise. You can also search by file type.

If you're using Windows XP, I wouldn't recommend Windows Live Search; it's slow and clunky.

您也可以尝试科莫多编辑。 它是一个支持多种语言并支持递归搜索目录的开发 IDE。 它是用 Java 编写的,因此可以在“每个”平台上运行。

http://www.activestate.com/komodo_edit/

You could also try Komodo Edit. It's a development IDE that supports many languages and has support for recursively searching directories. It's written in Java so it works on "every" platform.

http://www.activestate.com/komodo_edit/

自找没趣 2024-07-22 22:05:33

另一次投票给 ack。 它的用处怎么强调都不为过,它确实是处理大型代码库时最好的朋友。

Another vote for ack. It's usefulness can not be overstated, it truly is your best friend when dealing with a large code base.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文