Edit: Windows Grep is no longer being maintained or made available by the developer. An alternate download link is here: Windows Grep - alternate
Current Answer
Visual Studio Code has excellent search and replace capabilities across files. It is extremely fast, supports regex and live preview before replacement.
I like AstroGrep. The results are shown in a list. A click on a row shows you the whole line as a preview highlighting the hit.
It seems to be quite fast, lean and it is free.
Tested on Windows 7, 8, 10 and Windows Server 2008 R2.
Allows regular expressions.
AstroGrep is a Microsoft Windows GUI File Searching (grep) utility. Its features include regular expressions, versatile printing options, stores most recent used paths and has a "context" feature which is very nice for looking at source code
Visual Studio's search in folders is by far the fastest I've found.
I believe it intelligently searches only text (non-binary) files, and subsequent searches in the same folder are extremely fast, unlike with the other tools (likely the text files fit in the windows disk cache).
VS2010 on a regular hard drive, no SSD, takes 1 minute to search a 20GB folder with 26k files, source code and binaries mixed up. 15k files are searched - the rest are likely skipped due to being binary files. Subsequent searches in the same folder are on the order of seconds (until stuff gets evicted form the cache).
The next closest I've found for the same folder was grepWin. Around 3 minutes. I excluded files larger than 2000KB (default). The "Include binary files" setting seems to do nothing in terms of speeding up the search, it looks like binary files are still touched (bug?), but they don't show up in the search results. Subsequent searches all take the same 3 minutes - can't take advantage of hard drive cache. If I restrict to files smaller than 200k, the initial search is 2.5min and subsequent searches are on the order of seconds, about as fast as VS - in the cache.
Agent Ransack and FileSeek are both very slow on that folder, around 20min, due to searching through everything, including giant multi-gigabyte binary files. They search at about 10-20MB per second according to Resource Monitor.
UPDATE: Agent Ransack can be set to search files of certain sizes, and using the <200KB cutoff it's 1:15min for a fresh search and 5s for subsequent searches. Faster than grepWin and as fast as VS overall. It's actually pretty nice if you want to keep several searches in tabs and you don't want to pollute the VS recently searched folders list, and you want to keep the ability to search binaries, which VS doesn't seem to wanna do. Agent Ransack also creates an explorer context menu entry, so it's easy to launch from a folder. Same as grepWin but nicer UI and faster.
My new search setup is Agent Ransack for contents and Everything for file names (awesome tool, instant results!).
如果您不想安装非 Microsoft 工具,请下载 STRINGS.EXE 来自 Microsoft Sysinternals 并创建一个如下所示的过程:
@echo off
if '%1' == '' goto NOPARAM
if '%2' == '' goto NOPARAM
if not exist %1 goto NOFOLDER
echo ------------------------------------------
echo - %1 : folder
echo - %2 : string to be searched in the folder
echo - PLEASE WAIT FOR THE RESULTS ...
strings -s %1\* | findstr /i %2 > grep.txt
notepad.exe grep.txt
goto END
:NOPARAM rem - input command not correct
echo ====================================
echo Usage of GREP.CMD:
echo Grep "SearchFolder" SearchString
echo Please specify all parameters
echo ====================================
goto END
:NOFOLDER
echo Folder %1 does not exist
goto END
:END rem - exit
If you don't want to install Non-Microsoft tools, please download STRINGS.EXE from Microsoft Sysinternals and make a procedure like this one:
@echo off
if '%1' == '' goto NOPARAM
if '%2' == '' goto NOPARAM
if not exist %1 goto NOFOLDER
echo ------------------------------------------
echo - %1 : folder
echo - %2 : string to be searched in the folder
echo - PLEASE WAIT FOR THE RESULTS ...
strings -s %1\* | findstr /i %2 > grep.txt
notepad.exe grep.txt
goto END
:NOPARAM rem - input command not correct
echo ====================================
echo Usage of GREP.CMD:
echo Grep "SearchFolder" SearchString
echo Please specify all parameters
echo ====================================
goto END
:NOFOLDER
echo Folder %1 does not exist
goto END
:END rem - exit
发布评论
评论(6)
我喜欢 中的在文件中查找对话框记事本++。 奖励:它是免费的。
I'm a fan of the Find-In-Files dialog in Notepad++. Bonus: It's free.
还有一个名为
findstr.exe
的 Windows 内置程序您可以使用它在文件中进行搜索。There is also a Windows built-in program called
findstr.exe
with which you can search within files.原始答案
Windows Grep 做得非常好。
编辑: Windows Grep 不再由开发人员维护或提供。 备用下载链接位于:Windows Grep - 备用
当前答案
Visual Studio Code 具有出色的跨文件搜索和替换功能。 它速度非常快,支持正则表达式和替换前的实时预览。
Original Answer
Windows Grep does this really well.
Edit: Windows Grep is no longer being maintained or made available by the developer. An alternate download link is here: Windows Grep - alternate
Current Answer
Visual Studio Code has excellent search and replace capabilities across files. It is extremely fast, supports regex and live preview before replacement.
我喜欢 AstroGrep。 结果显示在列表中。 单击一行会显示整行预览,突出显示命中内容。
它看起来相当快、精简而且免费。
在 Windows 7、8、10 和 Windows Server 2008 R2 上进行了测试。
允许正则表达式。
参考:AstroGrep
I like AstroGrep. The results are shown in a list. A click on a row shows you the whole line as a preview highlighting the hit.
It seems to be quite fast, lean and it is free.
Tested on Windows 7, 8, 10 and Windows Server 2008 R2.
Allows regular expressions.
Reference: AstroGrep
Visual Studio 在文件夹中的搜索是迄今为止我发现的最快的。
我相信它只智能地搜索文本(非二进制)文件,并且在同一文件夹中的后续搜索速度非常快,这与其他工具不同(文本文件可能适合 Windows 磁盘缓存)。
VS2010 在普通硬盘(没有 SSD)上搜索一个 20GB 文件夹,其中包含 26k 个文件、源代码和二进制文件混合在一起,需要 1 分钟。 搜索了 15k 个文件 - 其余文件可能由于是二进制文件而被跳过。 在同一文件夹中的后续搜索大约需要几秒(直到内容从缓存中被逐出)。
我在同一文件夹中找到的下一个最接近的是 grepWin。 大约3分钟。 我排除了大于 2000KB(默认)的文件。 “包含二进制文件”设置似乎对加快搜索速度没有任何作用,看起来二进制文件仍然受到影响(错误?),但它们不会显示在搜索结果中。 随后的搜索都需要同样的 3 分钟 - 无法利用硬盘缓存。 如果我限制小于 200k 的文件,则初始搜索为 2.5 分钟,后续搜索约为秒,大约与 VS - 在缓存中一样快。
Agent Ransack 和 FileSeek 在该文件夹上的速度都很慢,大约需要 20 分钟,因为要搜索所有内容,包括巨大的数 GB 二进制文件。 根据资源监视器的数据,他们的搜索速度约为每秒 10-20MB。
更新:Agent Ransack 可以设置为搜索特定大小的文件,并且使用 <200KB 的截止时间,新搜索需要 1 分 15 分钟,后续搜索需要 5 秒。 比 grepWin 快,总体与 VS 一样快。 如果您想在选项卡中保留多个搜索,并且不想污染 VS 最近搜索的文件夹列表,并且希望保留搜索二进制文件的能力(VS 似乎不想这样做),那么这实际上非常好。 Agent Ransack 还创建了一个资源管理器上下文菜单条目,因此可以轻松地从文件夹启动。 与 grepWin 相同,但用户界面更好,速度更快。
我的新搜索设置是针对内容的 Agent Ransack 和针对文件名的 Everything(很棒的工具,即时结果!)。
Visual Studio's search in folders is by far the fastest I've found.
I believe it intelligently searches only text (non-binary) files, and subsequent searches in the same folder are extremely fast, unlike with the other tools (likely the text files fit in the windows disk cache).
VS2010 on a regular hard drive, no SSD, takes 1 minute to search a 20GB folder with 26k files, source code and binaries mixed up. 15k files are searched - the rest are likely skipped due to being binary files. Subsequent searches in the same folder are on the order of seconds (until stuff gets evicted form the cache).
The next closest I've found for the same folder was grepWin. Around 3 minutes. I excluded files larger than 2000KB (default). The "Include binary files" setting seems to do nothing in terms of speeding up the search, it looks like binary files are still touched (bug?), but they don't show up in the search results. Subsequent searches all take the same 3 minutes - can't take advantage of hard drive cache. If I restrict to files smaller than 200k, the initial search is 2.5min and subsequent searches are on the order of seconds, about as fast as VS - in the cache.
Agent Ransack and FileSeek are both very slow on that folder, around 20min, due to searching through everything, including giant multi-gigabyte binary files. They search at about 10-20MB per second according to Resource Monitor.
UPDATE: Agent Ransack can be set to search files of certain sizes, and using the <200KB cutoff it's 1:15min for a fresh search and 5s for subsequent searches. Faster than grepWin and as fast as VS overall. It's actually pretty nice if you want to keep several searches in tabs and you don't want to pollute the VS recently searched folders list, and you want to keep the ability to search binaries, which VS doesn't seem to wanna do. Agent Ransack also creates an explorer context menu entry, so it's easy to launch from a folder. Same as grepWin but nicer UI and faster.
My new search setup is Agent Ransack for contents and Everything for file names (awesome tool, instant results!).
如果您不想安装非 Microsoft 工具,请下载 STRINGS.EXE 来自 Microsoft Sysinternals 并创建一个如下所示的过程:
If you don't want to install Non-Microsoft tools, please download STRINGS.EXE from Microsoft Sysinternals and make a procedure like this one: