Windows命令提示符中是否有与grep类似的实用程序,或者是否有第三方工具?


当前回答

如果你必须使用纯Windows,那么除了上面提到的Powershell选项,你还可以使用VBScript,它有很好的RegEx支持。

MS在Technet上还有一个不错的脚本编写区,为管理员提供了大量的示例。

其他回答

我很惊讶没有人提到FINDSTR。我不是grep poweruser,但findstr做什么我需要它,过滤文件和stdin,与一些基本的正则表达式支持。装有Windows系统的船。(编辑:嗯,有人提到了findstr,我猜是晚了)

我已经有一段时间没有使用它们了,但是Borland(现在是Embarcadero)在他们的C/ c++编译器中包含了命令行grep。一段时间以来,他们在注册后就可以免费下载5.5版本。

使用Cygwin……

它有32位和64位版本 它在Windows 2000中工作良好(*) Windows 10或Server 2019

我用Cygwin很久了…… 最近尝试用windows - linux -子系统来替代…

不会太久…… 我很快又回到了Cygwin……

更加灵活、可控和丰富…… 也不那么打扰…

只需将\bin添加到路径… 你可以在Windows/Batch/Powershell中使用它… 或者在DOS-Box里…或者装在powershell盒子里…

你也可以安装很多很棒的软件包 这真的有用……比如nginX或PHP… 我甚至在我的IIS中使用Cygwin PHP包…

作为奖励,我们也可以在bash shell中使用它… (我认为这是最初的意图;-))

最近,我们使用PowerGREP对数千个文件进行了一些相当高级的批量操作。包括PDF文件内容的正则表达式搜索,以及大规模修改PDF文档。

如果你想节省体力劳动的时间,它值这个钱。我认为你可以在买之前试用一下。

Yes there is only one program for Windows PC which have solid GUI and it is essential util for me. I work as a developer and on every computer I've had, first thing install XFind program. It is created in 1997 and till now version is 1.0 and till now works and it is the best. Frequently I need to search some string in a ".cs", ".aspx", ".sct" (Visual FoxPro form code file) or just ".*" and XFind scans all files and show me files and another great thing is that you can look where string is in the file. XFind has also some kind of editor. If it binary file it will show you string finded. Try it and use it forever if you are developer like me.