Color grep for Windows

Looking for color grep for Windows? I was. I didn’t find exactly what I was looking for; instead, I found something better.

ack is a tool like grep, designed for programmers with large trees of heterogeneous source code.

ack + FAR screenshot
ack doesn’t enable or output colors on Windows by default. To get it all working, do the following:

  1. If you don’t have it yet, get ActivePerl.
  2. Download the standalone version of ack; save it with a .pl extension
  3. Create a batch file somewhere under %PATH% named ack.bat which invokes perl with ack:
    @C:\Perl\bin\perl.exe C:\Tools\ %*

    You should now be able to type ack arguments from anywhere, however this won’t get colors working right away. To do that:

  4. Install the Win32::Console::ANSI module using PPM (you’ll need to add the repository).
  5. In, add this line after the other two use lines:
    use Win32::Console::ANSI;
  6. Create a file named .ackrc in your user profile folder (usually C:\Documents and Settings\Username), with the contents:
    bold red

    bold red” (which actually means bright red) is my own preference; I think it’s nicer than the default “black on_yellow”, and the default color for grep (on *nix) as well.

That’s it!

One thought on “Color grep for Windows

  1. George Hafiz

    Looks like this is what you used to help you fix the W:A Wine bug (where return wasn’t sending chat messages). 🙂

    I have been exploring your digital life since letting your worms2d chat lead me here.


Leave a Reply

Your email address will not be published. Required fields are marked *