Tools to search for strings inside files without indexing [closed]

戏子无情 提交于 2019-12-05 00:28:37

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

BQ.

I'm a fan of the Find-In-Files dialog in Notepad++. Bonus: It's free.

JohnnyFromBF

There is also a Windows built-in program called findstr.exe with which you can search within files.

>findstr /s "provider=sqloledb" *.cs

Agent Ransack is another good one. It's fast, free and has some other nice features like shell integration.

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

Reference: AstroGrep

I'm a big fan of grepWin. It's free, lightweight and available from the explorer shell. I like not having to deliberately go find and start a program in order to search for something. I can just right click in explorer and bring it up.

SeekFast is very convenient to search text in files - text files, MS Word, Excel, OpenOffice and others. It has a free version.

FileSeek. It's fast and it's free. It can find text strings, or match regular expressions.

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!).

TextPad is really good for this sort of thing. You can use it for free, but you get a warning message asking you to buy it. Other than that it is an excellent tool all round.

FIBA

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

You could install cygwin (takes some time) and use grep -R .

I tend to always use grep or find from unxutils. This works great on ms-windows.

FileSearchy. It's quick and free. It does have indexing, but only for file names and not contents.

I'd recommend GOW over cygwin, as it's much lighter, but still includes grep as well as another 130 or so *nix command-line utils in 18MB instead of >100MB.

If you are looking for a console based utility to do that then you can refer to this url and create one for yourself.

http://www.dotnetlogic.net/articles/search-for-filename-or-text-inside-other-files-in-directory-using-c/

what is does is find the list of search text in folder and return file matching with same name also returns if some file contains the text also

I can recommend ack - a command line program with linux roots, which fortunately works great also on Windows. It's faster than grep, it ignores git/subversion directories and binary files, and the output is more comprehensible. And typing ack is 25% faster than grep ;)

http://beyondgrep.com/

I tried it on babun (cygwin) and msys from git - works fabulously. It's written in perl so should work also in cmd.exe with perl installed somewhere on OS.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!