288

Any recommendations on grep tools for Windows? Ideally ones that could leverage 64-bit OS.

I'm aware of Cygwin, of course, and have also found PowerGREP, but I'm wondering if there are any hidden gems out there?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Portman
  • 31,785
  • 25
  • 82
  • 101

28 Answers28

343

FINDSTR is fairly powerful, supports regular expressions and has the advantages of being on all Windows machines already.

c:\> FindStr /?

Searches for strings in files.

FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]
        [/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]
        strings [[drive:][path]filename[ ...]]

  /B         Matches pattern if at the beginning of a line.
  /E         Matches pattern if at the end of a line.
  /L         Uses search strings literally.
  /R         Uses search strings as regular expressions.
  /S         Searches for matching files in the current directory and all
             subdirectories.
  /I         Specifies that the search is not to be case-sensitive.
  /X         Prints lines that match exactly.
  /V         Prints only lines that do not contain a match.
  /N         Prints the line number before each line that matches.
  /M         Prints only the filename if a file contains a match.
  /O         Prints character offset before each matching line.
  /P         Skip files with non-printable characters.
  /OFF[LINE] Do not skip files with offline attribute set.
  /A:attr    Specifies color attribute with two hex digits. See "color /?"
  /F:file    Reads file list from the specified file(/ stands for console).
  /C:string  Uses specified string as a literal search string.
  /G:file    Gets search strings from the specified file(/ stands for console).
  /D:dir     Search a semicolon delimited list of directories
  strings    Text to be searched for.
  [drive:][path]filename
             Specifies a file or files to search.

Use spaces to separate multiple search strings unless the argument is prefixed
with /C.  For example, 'FINDSTR "hello there" x.y' searches for "hello" or
"there" in file x.y.  'FINDSTR /C:"hello there" x.y' searches for
"hello there" in file x.y.

Regular expression quick reference:
  .        Wildcard: any character
  *        Repeat: zero or more occurances of previous character or class
  ^        Line position: beginning of line
  $        Line position: end of line
  [class]  Character class: any one character in set
  [^class] Inverse class: any one character not in set
  [x-y]    Range: any characters within the specified range
  \x       Escape: literal use of metacharacter x
  \<xyz    Word position: beginning of word
  xyz\>    Word position: end of word

Example usage: findstr text_to_find * or to search recursively findstr /s text_to_find *

rogerdpack
  • 62,887
  • 36
  • 269
  • 388
Ray Hayes
  • 14,896
  • 8
  • 53
  • 78
  • 2
    What FINDSTR lacks is an option to display only the count of lines containing the string. (like grep -c) If you need this you can use FIND /C. – Ra. Jun 11 '09 at 06:27
  • 2
    If you want the FINDSTR power back (and your pattern isn't regex), you could always, with some small repetition, chain the two commands together: findstr /s ".ini" *.rlog | find /c ".ini" – Ray Hayes Jun 16 '09 at 07:44
  • 11
    Findstr does not have a fully RegEx support. – caltuntas Jun 29 '09 at 08:36
  • 5
    .. the original post wasn't asking specifically for RegEx! – Ray Hayes Jun 29 '09 at 10:32
  • As per what I found with GNU Grep, it seems that FindStr doesn't like 10Mb text files either. – Peter M Oct 30 '09 at 15:14
  • 25
    OK findstr it isn't grep, as some of the other commentators pointed out. But I didn't even know it existed so +1 to you good sir for posting it! – T.Rob Apr 19 '12 at 18:46
  • 2
    FindStr, at least under Windows 7, does support regular expressions with the use of the /R option. – mk. Apr 27 '13 at 16:45
  • This does not seem to be available on Windows XP – Alister Jul 01 '13 at 19:14
  • It should be, at the time of writing the response that was what I was stuck using at work. Should be in your Windows\System32 folder - have you not got that on your path? – Ray Hayes Jul 03 '13 at 10:44
  • 1
    Is documented by Microsoft in the Windows XP Pro documentation: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/findstr.mspx – Ray Hayes Jul 03 '13 at 10:47
  • ".. FINDSTR was introduced in the Windows NT 4 Resource Kit and is now a native command in Windows 2000 and later." (from: http://www.robvanderwoude.com/findstr.php) – Ray Hayes Jul 03 '13 at 10:49
  • @mk Only a limited subset of regex support has been implemented. For instance, I cannot find repeating subpatterns: (test)-\1.txt – EpicVoyage Sep 17 '13 at 23:13
  • Findstr also supports only ANSI files. – custom_user Apr 26 '18 at 08:07
  • findStr was good for my cross-platform file manager. It let me create a script to mimic my grep script for linux/mac. Using my cross-platform FM, I can search for say **.java. Gives me a list of all *.java in a project say. I select them all. right-click -> menu-scripts -> findStrGrep. enter a string to search for and it runs findStr on my list of files and gives me the output! The script is just groovy and you can simply modify it and run again. The scripts can manipulate the files or whatever. https://github.com/stant/jfileprocessorRest nice that findStr was build in. – Stan Towianski Jun 11 '18 at 04:58
  • I believe that example is incorrect "findstr text_to_find *" you have to use findstr /c:"text_to_find" * – Gerry Jan 19 '23 at 17:51
  • findstr to show the number of matches in a file? Install grep – Gerry Jan 19 '23 at 18:18
221

Based on recommendations in the comments, I've started using grepWin and it's fantastic and free.


(I'm still a fan of PowerGREP, but I don't use it anymore.)

I know you already mentioned it, but PowerGREP is awesome.

Some of my favorite features are:

  • Right-click on a folder to run PowerGREP on it
  • Use regular expressions or literal text
  • Specify wildcards for files to include & exclude
  • Search & replace
  • Preview mode is nice because you can make sure you're replacing what you intend to.

Now I realize that the other grep tools can do all of the above. It's just that PowerGREP packages all of the functionality into a very easy-to-use GUI.

From the same wonderful folks who brought you RegexBuddy and who I have no affiliation with beyond loving their stuff. (It should be noted that RegexBuddy includes a basic version of grep (for Windows) itself and it costs a lot less than PowerGREP.)


Additional solutions

Existing Windows commands

Linux command implementations on Windows

Grep tools with a graphical interface

Additional Grep tools

Gian Marco
  • 22,140
  • 8
  • 55
  • 44
Mark Biek
  • 146,731
  • 54
  • 156
  • 201
  • 4
    I'd love to find an open-source grep gui as easy to use & as full featured as PowerGREP but I haven't found one yet :). I do have Cygwin installed and use grep from that quite a bit too. – Mark Biek Nov 04 '10 at 00:09
  • 21
    @Wells - plain old *nix grep on Windows is free via Cygwin or GnuWin32. FindStr and Find are also shipped with Windows. Grep with a great GUI, the ability to replace, and integrated undo, as well as many other features ...yeah... that costs you a little extra. – Mike Clark Nov 19 '10 at 05:37
  • 11
    @Wells, @Mike Clark, @Mark Biek: I suppose it's possible that there weren't nice free GUI grep tools for Windows when this answer was posted, but it's no longer true. grepWin has all the features listed in this answer, and there may be other competitors now as well. – John Y Mar 16 '11 at 20:16
  • In regards to my previous comment: Actually, it would seem AstroGrep has been around a very long time, with what to me is an easy-to-use GUI. The main knock against it, in my opinion, is that it is not as easily discoverable as WinGrep and grepWin. (I didn't know about AstroGrep till just now, looking at answers below.) – John Y Mar 16 '11 at 20:27
  • AstroGrep seems kinda dead (last release back in 2007). dnGREP (http://code.google.com/p/dngrep/) is another open source project that is actively supported and has similar functionality as PowerGREP. – stankovski May 17 '11 at 18:32
  • PowerGrep does not search properly into hidden directories... and there is no option to enable this. GrepWin does it and it is free, which is another plus. – Jérôme Verstrynge Jun 17 '11 at 15:54
  • 9
    @Wells, hating Windows because a Grep tool is $159 is like hating cars because floor mats are expensive. – md1337 Dec 04 '12 at 16:01
  • Hidden directories appear to be searchable in PowerGREP by checking an option: http://www.powergrep.com/manual/prefsfilesel.html. Anyone know different? – gwideman Feb 08 '13 at 23:03
  • 9
    @Wells and upvoters: What's the beef? Several other GREP tools for Windows are just as free as for unix/linux. Indeed, this is what I love about the Windows ecosystem -- lots of free, if that's your main criterion, AND the ecosystem often supports paying developers for exploring extended amounts of functionality, such as with PowerGREP. PowerGREP may not be everyone's cup of tea (sometimes its UI is overwhelming), but its elaborateness does have utility. – gwideman Feb 08 '13 at 23:07
  • There is also [Subsystem for Unix-based applications](https://technet.microsoft.com/en-gb/library/cc772343.aspx) on certain Windows versions. – Kunal Aug 09 '16 at 19:01
  • Also, if you have [Git for Windows](https://git-scm.com/) installed, you have _Git Bash_ (with **grep** command). – Josem Feb 08 '19 at 18:22
  • I'm working on a new grep software aimed at being simple to use. PowerGrep was too expensive and I didn't like the interface of GrepWin. https://easygrep.com – user2924019 Feb 24 '19 at 22:02
115

GrepWin is free and open source (GPL)

Enter image description here

I've been using grepWin which was written by one of the TortoiseSVN guys. It does the job on Windows...

Gian Marco
  • 22,140
  • 8
  • 55
  • 44
Stan Sarama
  • 701
  • 1
  • 5
  • 2
  • 2
    And it is free and it is capable of searching in hidden directories/files which PowerGrep is not capable of doing properly... – Jérôme Verstrynge Jun 17 '11 at 15:54
  • 3
    Doesn't seem to have a command line interface. – Andreas Haferburg Aug 27 '12 at 14:31
  • 2
    It's good but it only gives one line of context, and you can't see that context until it's finished the entire search. – Matthew Lock Apr 08 '14 at 03:45
  • 2
    It seems like a nice and simple tool. But I needed the results in a file and it doesn't seem to give me the option to export. For that reason alone I went with AstroGrep. – Ross Jun 10 '15 at 18:55
  • doesn't search in pdf – JinSnow Nov 13 '15 at 08:02
  • I've had a number of issues with grepWin. Most importantly, it does not always find all occurences! I'm trying out AstroGrep now, and it finds many occurences in the same files that grepWin does not. Also, the binaries are distributed over HTTP and not HTTPS. – Zero3 Apr 06 '17 at 15:56
  • unfortunately, i could not find an option to exclude a particular regular expression while matching another regular expression, equivalent to ````grep containsword directory|grep -v doesnotcontainword```` – computingfreak Dec 07 '18 at 10:10
  • Didn't work great for me on my Win10. The "Search" button seems to be hanging. So I had to swtich to AstroGrep – SyncMaster Aug 23 '21 at 19:38
59

Update July 2013:

Another grep tool I now use all the time on Windows is AstroGrep:

AstroGrep awesomeness

Its ability to show me more than just the line search (i.e. the --context=NUM of a command-line grep) is invaluable.
And it is fast. Very fast, even on an old computer with non-SSD drive (I know, they used to do this hard drive with spinning disks, called platters, crazy right?)

It is free.
It is portable (simple zip archive to unzip).


Original answer October 2008

alt textGnu Grep is alright

You can download it for example here: (site ftp)

All the usual options are here.

That, combined with gawk and xargs (includes 'find', from GnuWin32), and you can really script like you were on Unix!

See also the options I am using to grep recursively:

grep --include "*.xxx" -nRHI "my Text to grep" *
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I just started looking for a replacement for Gnu Grep as the windows version doesn't seem to be able to handle my 10 Mb text files. It just sits there and pretends not to have found anything. If I cut down the file size it starts to work. – Peter M Oct 30 '09 at 15:05
  • Hello VonV, your link of "usual options" has become: 404 - Page Not Found. Please consider editing your answer. – eeerahul Apr 26 '13 at 08:21
  • 1
    @eeerahul link restored, and example added – VonC Apr 26 '13 at 08:30
  • AstroGrep is nice but unfortunately it currently lacks 'Find & Replace' feature, which is deal breaker for me – Łukasz Wiatrak Apr 12 '14 at 10:18
  • It lacks the "replace" function – XristosK Apr 13 '15 at 10:45
  • I just started using it based on this recommendation. I love the context feature. – dmarlow Sep 25 '15 at 20:39
  • doesn't search in pdf – JinSnow Nov 13 '15 at 08:03
  • Just downloaded this, and it's unfortunate how slow it is compared to grepWin. Searching in a 190k file pool it is a LOT slower. The context lines feature is indeed very nice though. I'll try to reduce my file counts to still keep using it as it's much nicer than grepWin. – julealgon Jan 18 '16 at 14:59
  • @julealgon I now use http://docfetcher.sourceforge.net/en/index.html: not a grep tool, but *fast*. – VonC Jan 18 '16 at 15:00
  • As of right now, Astrogrep is basically unusable on 4k monitors. – DarrellNorton Apr 26 '16 at 15:25
  • It is good - feature wise - and probably one of the few that has the "negation" option which allows complicated searches. But it is *incredibly* slow. Its .NET code is more than 20x slower (measured) than at least 3 other alternatives that I tried (all native implementations) – Alexandre M Apr 14 '21 at 21:01
  • @AlexandreM Very possible: nowadays, everything is Rust (https://www.rust-lang.org/), and ripgrep is so fast: https://github.com/BurntSushi/ripgrep (and yes, it has negation too: https://github.com/BurntSushi/ripgrep/blob/64ac2ebe0f2fe1c8967e7ec550bc32466bf40a07/GUIDE.md#user-content-manual-filtering-globs) – VonC Apr 14 '21 at 22:37
32

PowerShell's Select-String cmdlet was fine in v1.0, but it is significantly better for v2.0. Having PowerShell built in to recent versions of Windows means your skills here will always be useful, without first installing something.

New parameters added to Select-String: Select-String cmdlet now supports new parameters, such as:

  • -Context: This allows you to see lines before and after the match line
  • -AllMatches: which allows you to see all matches in a line (Previously, you could see only the first match in a line)
  • -NotMatch: Equivalent to grep -v o
  • -Encoding: to specify the character encoding

I find it expedient to create an function gcir for Get-ChildItem -Recurse ., with smarts to pass parameters correctly, and an alias ss for Select-String. So you an write:

gcir *.txt | ss foo

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jay Bazuzi
  • 45,157
  • 15
  • 111
  • 168
  • 3
    Example of grep -R equivilant: Get-ChildItem -recurse -include *.txt | Select-String -CaseSenstive "SomeString" – jslatts Mar 11 '11 at 21:48
  • 6
    I really like a lot of the functionality introduced in PS, but why does every command have to be longer than the average COBOL program? – evilcandybag Feb 20 '12 at 17:17
  • 3
    @evilcandybag: Thanks to great autocomplete, including autocomplete on parameter names, typing PowerShell command lines is fast & easy, and I can read the result. – Jay Bazuzi Feb 22 '12 at 17:43
  • 1
    @jslatts: or you could use aliases and partial parameter names and it would be `ls . *.txt -r| sls -ca "SomeString"` – Rynant Jan 14 '15 at 22:29
  • 2
    Is the existing alias `sls` for `Select-String` really too long? – Joey Nov 10 '16 at 09:01
23

It may not exactly fall into the 'grep' category, but I couldn't get by on Windows without a utility called AgentRansack. It's a GUI-based "find in files" utility with regex support.

It's dead simple to right-click on a folder, hit "ransack.." and find files containing what you're looking for. It is extremely fast too.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jasonmray
  • 2,350
  • 2
  • 19
  • 14
19

Baregrep (Baretail is good too)

John Sheehan
  • 77,456
  • 30
  • 160
  • 194
17

I'd recommend AstroGrep.

It's free, open source, and has a simple interface. I use it to search code all the time.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jj.
  • 2,210
  • 3
  • 21
  • 22
  • but it doesn't search in pdf – JinSnow Nov 13 '15 at 08:03
  • This is already covered in another answer. – Peter Mortensen Nov 22 '21 at 22:16
  • This is several years later but it now searches PDFs. I am using version 4.4.7. It can be installed using chocolatey making it easy to install. The main drawback is that it is a GUI and although it claims to accept command line arguments the one page command line help is pretty cryptic with no definition of the command line, just flag definitions, and whatever I tried from the cmd line just caused the GUI to pop up as if I had not used any arguments. – G. Grothendieck May 22 '22 at 11:27
17

PowerShell has been mentioned a few times. Here is how you would actually use it in a grepish way:

Get-ChildItem -recurse -include *.txt | Select-String -CaseSensitive "SomeString"

It recursively searches all text files in the current directory tree for SomeString with case sensitivity.

Even better, run this:

function pgrep { param([string]$search, [string]$inc) Get-ChildItem -recurse -include $inc | Select-String -CaseSensitive $search }

Then do:

pgrep SomeStringToSearch *.txt

Then to really make it magical, add the function alias to your PowerShell Profile and you can almost dull the pain of not having proper command line tools.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
jslatts
  • 9,307
  • 5
  • 35
  • 38
  • Aliases can be used to reduce the amount of typing. For instance, [Get-ChildItem has three](https://pvm-professionalengineering.blogspot.com/2019/10/powershell-aliases-and-missing.html): *ls*, *dir*, and *gci*. – Peter Mortensen Nov 22 '21 at 22:31
17

Git on Windows = grep in cmd.exe

I just found out installing Git will give you some basic Linux commands: cat, grep, scp and all other good ones.

Install then add the Git bin folder to your PATH and then your cmd.exe has basic Linux functionality!

http://code.google.com/p/msysgit/downloads/list?can=3

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Daniel Magnusson
  • 9,541
  • 2
  • 38
  • 43
14

dnGREP is an open source grep tool for Windows. It supports a number of cool features including:

  • Undo for replace
  • Ability to search by right clicking on folder in explorer
  • Advance search options such as phonetic search and xpath
  • Search inside PDF files, archives, and Word documents

IMHO, it has a nice and clean interface too :)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
stankovski
  • 2,129
  • 2
  • 16
  • 11
14

ack works well on Windows (if you've got Perl). I find it better than grep for many uses.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
cjm
  • 61,471
  • 9
  • 126
  • 175
14

Cygwin includes grep. All the GNU tools and Unix stuff works great on Windows if you install Cygwin.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Corey Goldberg
  • 59,062
  • 28
  • 129
  • 143
7

I always use WinGREP, but I've had issues with it not letting go of files.

Tom Kidd
  • 12,830
  • 19
  • 89
  • 128
  • 2
    I've used wingrep for several years, it's great with the exception that the directory select boxes are far too small – Cruachan Jun 10 '09 at 10:15
  • The [license](http://www.wingrep.com/register.htm) requires you to pay for it after a 30day eval. – chip May 31 '13 at 16:30
  • It has a nice feature that many grep tools don't, the ability to invert matches. Handy for finding HTML files without something in them, say. – Matthew Lock Aug 21 '13 at 01:19
  • I've noticed a very annoying feature of WinGrep though. It seems to keep a file lock on all the matches it's made, and so if you try and delete one of those files in Windows Explorer you can't until you close WinGrep. – Matthew Lock Apr 08 '14 at 03:46
  • If it could search in search results, narrowing the list even further, that would be an ideal tool for me. – Shamil Sep 17 '14 at 21:43
  • And it lucks support for nonEnglish characters – XristosK Apr 13 '15 at 10:46
7

Well, besides the Windows port of the GNU grep, there's also Borland's grep (very similar to the GNU one) available in the freeware Borland's Free C++ Compiler (it's a freeware with command-line tools).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Milan Babuškov
  • 59,775
  • 49
  • 126
  • 179
7

I have successfully used GNU utilities for Win32 for quite some time and it has a good grep as well as tail and other handy GNU utilities for Win32. I avoid the packaged shell and simply use the executables right in Win32 command prompt.

The tail that is packaged is quite a good little application as well.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user17314
  • 51
  • 1
6

I'm the author of Aba Search and Replace. Just like PowerGREP, it supports regular expressions, saving patterns for further use, undo for replacements, preview with syntax highlight for HTML/CSS/JS/PHP, different encodings, including UTF-8 and UTF-16.

In comparison with PowerGREP, the GUI is less cluttered. Aba instantly starts searching as you are typing the pattern (incremental search), so you can experiment with regular expressions and immediately see the results.

You are welcomed to try my tool; I will be happy to answer any questions.

Peter Kankowski
  • 166
  • 1
  • 2
4

I wanted a free grep tool for Windows that allowed you to right click on a folder and do a regex search of every file - without any nag screen.

The following is a quick solution based on the findstr mentioned in a previous post.

Create a text file somewhere on your hard drive where you keep long lived tools. Rename to .bat or .cmd and paste the following into it:

@echo off
set /p term="Search term> "
del %temp%\grepresult.txt
findstr /i /S /R /n /C:"%term%" "%~1\*.*" > "%temp%\grepresult.txt"
start notepad "%temp%\grepresult.txt"

Then browse to the SendTo folder. On Windows 7 browse to %APPDATA%\Microsoft\Windows\SendTo and drag a shortcut of the batch file to that SendTo folder.

I renamed the shortcut to 1 GREP to keep it at the top of the SendTo list.

Things that I'd like to do next with this is pipe the output of findstr through something that would generate an html file so that you could click on each output line to open that file. Also, I don't think it works with shortcuts to folders. I'd have to inspect the parameter and see if it contains ".lnk".

DarthJDG
  • 16,511
  • 11
  • 49
  • 56
Philip Beck
  • 375
  • 2
  • 10
3

I used Borland's grep for years, but I just found a pattern that it won't match. Eeeks. What else hasn't it found over the years? I wrote a simple text search replacement that does recursion like grep - it's FS.EXE on SourceForge.

grep fails...

C:\DEV> GREP GAAPRNTR \SOURCE\TPALIB\*.PRG
<no results>

Windows' findstr works...

C:\DEV> FINDSTR GAAPRNTR \SOURCE\TPALIB\*.PRG
\SOURCE\TPALIB\TPGAAUPD.PRG:ffSPOOL(cRPTFILE, MEM->GAAPRNTR, MEM->NETTYPE)
\SOURCE\TPALIB\TPPRINTR.PRG:    AADD(mPRINTER,   TPACONFG->GAAPRNTR)
\SOURCE\TPALIB\TPPRINTR.PRG:               IF TRIM(TPACONFG->GAAPRNTR) <> TRIM(mPRINTER[2])
\SOURCE\TPALIB\TPPRINTR.PRG:                   REPLACE TPACONFG->GAAPRNTR WITH mPRINTER[2]
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jerry Lusa
  • 29
  • 1
3

My tool of choice is the appropriately named Windows Grep:

  • nice simple GUI
  • supports search and replace
  • can show the lines around the lines found
  • can search within columns in CSVs and fixed-width files
John N
  • 1,755
  • 17
  • 21
  • 1
    Unfortunately discontinued, I have used it for years. – alimack Aug 19 '17 at 11:17
  • 1
    @alimack Yes, I noticed this myself recently. However, the tool still works (on Windows 7 at least), and can still be downloaded from the likes of CNET. A shame, it was a pretty nice tool. – John N Aug 21 '17 at 11:20
  • Looking for a replacement, PowerGREP promising but ugly interface and v expensive. Tried grepWin, too bare bones, Filelocator doesn't seem to do replacement of text. Suggestions welcome - particularly like seeing results before I commit to replace. – alimack Aug 22 '17 at 14:57
  • All these years later I'm still using Windows Grep! :) Only annoying thing is that, as @alimack mentioned, it's discontinued so you can't register the program and disable the "register" message when you quit the application. (Unless anyone has a key and can share one? ;) ) – Richard Muthwill Mar 06 '21 at 23:37
  • The link now takes you to some iffy recommendation site. – tripleee Aug 09 '21 at 07:08
  • 1
    @tripleee Link removed - thanks for the heads up – John N Aug 10 '21 at 09:20
3

UnxUtils is the one I use, and it works perfectly for me...

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Johan
  • 1,940
  • 1
  • 13
  • 18
2

Another good choice is MSYS. It gives you a bunch of other GNU utilities to allow you to be more productive.

DDay
  • 698
  • 1
  • 9
  • 17
2

PowerShell's Select-String is similar. It does not have the same options and semantics, but it's still powerful.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jim Deville
  • 10,632
  • 1
  • 37
  • 47
1

If you want a simple-to-use Windows Grep tool, I created one called P-Grep that I have made available for free download from my website: www.adjutantit.com - home menu, downloads.

Windows Grep seemed to have problems with a large number of files, so I wrote my own - which seems more reliable. You can select a folder, right click and send it to P-Grep. The sendto folder gets updated during installation.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • 2
    The link is broken: *"Hmm. We’re having trouble finding that site. We can’t connect to the server at www.adjutantit.com."* – Peter Mortensen Nov 22 '21 at 22:39
1

I've been using AJC Grep daily for years. The only major limitation I've found is that file paths are limited to 255 characters and it stops when it encounters one, rather than just issuing a warning. It's annoying but doesn't happen very often.

I use it on 64-bit Windows 7 Ultimate, so its 64-bit credentials are fine.

CrispinH
  • 1,899
  • 4
  • 23
  • 38
  • This is only 5 less than [the common 260 character limit in Windows](https://stackoverflow.com/questions/1880321/why-does-the-260-character-path-length-limit-exist-in-windows) (may or may not have been lifted in some versions of Windows in some contexts). When did it make a difference? Did you encounter file paths in the range [256;260]? – Peter Mortensen Nov 22 '21 at 22:43
  • I've pretty much stopped using AJC Grep and now use grepWin. – CrispinH Nov 23 '21 at 11:52
1

GREP for Windows

I've been using it forever and luckily it's still available. It's super fast and very small.

bbrown
  • 6,370
  • 5
  • 37
  • 43
  • Is there even a GUI? I just use it from the command line so I never realized. – bbrown Jan 19 '12 at 22:29
  • I was looking for a simple way to show lines before and after the match and this one did it. For instance: run 'netstat -anb | grep -B1 22' to know which programs listen to port 22. – Jan Ehrhardt Aug 15 '14 at 15:24
0

I have Cygwin installed on my machine and put the Cygwin bin directory in my environmental path, so the Cygwin grep works like normal in a command line which solves all my scripting needs for grep at the moment.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Satyrn
  • 63
  • 7
0

If none of the solutions is quite what you are looking for, perhaps you could write a wrapper to FindStr that does exactly what you require?

FindStr is pretty good anyway so it should just be knocking a GUI up (if you want it) and providing a few extra features (like combining it with Find to find the count of files which contain a specified string [mentioned above]).

This, of course, assumes you have the requirement, time and inclination to do this!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Stefan
  • 3,669
  • 2
  • 32
  • 43