What are good grep tools for Windows? [closed]

2019-01-01 14:04发布

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?

标签: windows grep
28条回答
公子世无双
2楼-- · 2019-01-01 14:26

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

查看更多
骚的不知所云
3楼-- · 2019-01-01 14:27

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

http://www.cygwin.com/

查看更多
看淡一切
4楼-- · 2019-01-01 14:28

PowerShell's Select-String cmdlet was fine in v1.0, but is significantly better for v2.0. Having PowerShell built in to recent versions of Windows means your skills here will always 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

查看更多
与风俱净
5楼-- · 2019-01-01 14:28

Baregrep (Baretail is good too)

查看更多
一个人的天荒地老
6楼-- · 2019-01-01 14:28

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

查看更多
呛了眼睛熬了心
7楼-- · 2019-01-01 14:28

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

查看更多
登录 后发表回答