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


当前回答

我知道这是一个老问题,但我看到这个帖子寻求答案。我找到了一个,所以把它添加到这里,作为互联网的集体记忆

Powershell:选择string 模块: Microsoft.PowerShell.Utility

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/select-string

以及一篇包含高级示例的内容丰富的博客文章:“如何在PowerShell中“grep”” https://antjanus.com/blog/web-development-tutorials/how-to-grep-in-powershell/

举个简单的例子: 猫包。选择字符串-模式webpack . json | ls ./src/components/ | Select-String -Pattern View

C:>猫帖。md | Select-String -Pattern "^\w*:"

其他回答

更新:最初问这个问题的时候不是这样的,但是现在微软允许为Linux安装Windows子系统,然后Windows将运行grep。在PowerShell中运行:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Cygwin grep和更多;)

如果你想要一个GUI, Bare Grep是不错的选择。Gnu grep适合CLI

如果您不介意付费产品,PowerGREP是我个人的最爱。

在windows reskit中有一个名为“qgrep”的实用程序。你的盒子上可能已经有了。;-)它还带有“尾巴”命令,感谢上帝!