Unicode grep for Windows

5,977

Solution 1

For a command line tool, look at KeyboardMonkey answer (but I'm not sure about Unicode support).

For an (open source) GUI tool: dnGREP

  • Shell integration (ability to search from Windows Explorer)
  • Plain text, regular expression, and XPath search (including case-insensitive search)
  • Phonetic search (using Bitap and Needleman-Wunch algorithms)
  • File move/copy/delete actions
  • Search inside archives / MS Word documents / PDF documents (via plug-ins)
  • Undo functionality
  • Optional integration with text editor (like Notepad++)
  • Bookmarks (ability to save regular expression searches for the future)
  • Pattern test form
  • Search result highlighting
  • Does not require installation (can be run from a USB drive)

enter image description here

For a more simple (only search) GUI tool: AstroGrep and for a more featured (and expensive) one: PowerGREP

Solution 2

Most versions of Windows include the command "findstr" which works much like grep. I do not know about its Unicode abilities, but to my knowledge there shouldn't be any problems with that.

Solution 3

Update: GnuWin32 is a more recently maintained port of these tools. (Thanks Quack)

Here is a list of the packages and to download grep individually.

Have a look at UnxUtils, which includes grep as well. I use these on my work PC, too.

Solution 4

The simplest way to do this there is a Windows utility called "strings" which does exactly what you're after:

Strings (Sysinternals)

Basically, it pulls all the Unicode characters out of files, so you can then pipe it to whatever Windows grepalike you use, be it findstr (native) or like me, gnuwin32 grep for Windows (does what it says on the tin).

So you get something like:

strings *.odf | grep -i  "texttosearch"

findstr works too for a lot of things but grep is just all around better.

Solution 5

Yes, as fluxtendu mentions,

  • PowerGREP will do all that. But it is proprietary and costs 149 Euros.
  • dnGREP will work too, and has a similar feature set for free.

However,

  • Cygwin can also install grep (and a whole lot more if you want.) It will do Unicode search with the -U switch. I would recommend Cygwin as the simplest solution if you're familiar with Unix grep. Just make sure to append your PATH and you can use it in the Windows shell too.
Share:
5,977
Jeroen Wiert Pluimers
Author by

Jeroen Wiert Pluimers

Makes things work. Specialist in .NET, Win32, x64, C#, SQL, Visual Studio and Delphi. Knows how to strike a balance between old and brand new technology to make things work. DOS, mobile, big systems, you name it. Surviving rectal cancer. Married to a cancer survivor. As curator responsible for his brother that has an IQ < 50 and autism. 40+ year member of world class marching band Adest Musica. Trained and performed a few half marathons including 2013 NY and 2014 Naples, FL. Twitter: jpluimers Blog: wiert.me github: jpluimers LinkedIn: jwpluimers Keybase.io: wiert StackExchange/StackOverflow: stackexchange.com/users/14295

Updated on September 17, 2022

Comments

  • Jeroen Wiert Pluimers
    Jeroen Wiert Pluimers over 1 year

    Is there a Unicode-aware grep for Windows 32-bit?

    • Peter Mortensen
      Peter Mortensen almost 12 years
      Did you find one that worked with Unicode? It is not at all clear in the answers if the different tools are Unicode-aware or not.
    • Jeroen Wiert Pluimers
      Jeroen Wiert Pluimers almost 12 years
      I gave up and used the built-in search of Visual Studio (:
  • fluxtendu
    fluxtendu about 14 years
    According to gizmo's freeware, "Replace Text" ecobyte.com/replacetext is another interesting option
  • quack quixote
    quack quixote about 14 years
    UnxUtils is old and unsupported -- last updated in 2003. try GnuWin32 for a more recent toolset: gnuwin32.sourceforge.net
  • Dany
    Dany over 10 years
    I'm pretty sure it does NOT support Unicode. I tried it and it doesn't work on UTF-16 files. Have emailed them to confirm.
  • G-Man Says 'Reinstate Monica'
    G-Man Says 'Reinstate Monica' almost 9 years
    How, exactly, does this answer the question?  The strings program is used for finding text strings that are mixed in with non-text (“binary”) data; e.g., executable files.  The question doesn’t say anything about having text strings embedded in binary data.  … … … … … … … …  What if I want to search a Unicode text file for characters like π and ?  Would I type strings dissertation | findstr "π"?  Doesfindstr handle Unicode?  If it does, then why not just say findstr "π" dissertation, which was suggested five years ago?  If it doesn’t, then what have you gained?
  • Some_Guy
    Some_Guy almost 9 years
    good point. I suppose I didn't properly grasp what the questioner was after
  • pepoluan
    pepoluan about 7 years
    Sorry for the necro, but THANK YOU!! I desperately this tool in Windows, and this dnGREP is a godsend!