Windows有哪些好的grep工具?
关于Windows的grep工具有什么建议吗?理想情况下,可以利用64位OS。
我当然知道Cygwin,也找到了PowerGREP,但我想知道那里是否有隐藏的宝石?
解决方案
回答
PowerShell的选择字符串与之类似,它的选项和语义不尽相同,但功能仍然很强大。
回答
我一直使用WinGREP,但我遇到了一些问题,即文件无法释放。
回答
2013年7月更新:
我现在在Windows上一直使用的另一个grep工具是AstroGrep:
它不仅可以显示行搜索(即命令行grep的--context = NUM),而且还可以显示给我更多的能力。
而且速度很快。即使在装有非SSD驱动器的旧计算机上,速度也非常快(我知道,他们曾经使用旋转磁盘(称为磁盘)来制作此硬盘,疯狂吗?)
这是免费的。
它是便携式的(简单的zip存档即可解压缩)。
原答复2008年10月
Gnu Grep很好
我们可以在此处下载示例:(站点ftp)
所有常用的选项都在这里。
结合了gawk和xargs(包括来自GnuWin32的'find'),我们可以像在Unix上一样真正编写脚本!
另请参阅我用于递归grep的选项:
grep --include "*.xxx" -nRHI "my Text to grep" *
回答
根据评论中的建议,我已经开始使用grepWin,它非常棒且免费。
(我仍然是PowerGREP的粉丝,但是我不再使用它了。)
我知道我们已经提到过,但是PowerGREP很棒。
我最喜欢的一些功能是:
- 右键单击一个文件夹以在其上运行PowerGREP
- 使用正则表达式或者文字文本
- 为文件指定通配符以包括和排除
- 搜索和替换
- 预览模式很不错,因为我们可以确保要替换的内容。
现在,我意识到其他grep工具可以完成上述所有操作。只是PowerGREP将所有功能打包到一个非常易于使用的GUI中。
来自那些带给我们RegexBuddy的杰出人士,而我除了热爱他们的东西外没有任何隶属关系。 (应注意,RegexBuddy本身包含基本版本的grep(适用于Windows),并且其价格比PowerGREP便宜得多。)
其他解决方案
现有的Windows命令
- FINDSTR
- 在PowerShell中选择字符串
Windows上的Linux命令实现
- 西格温
- 现金
具有图形界面的Grep工具
- 天文Grep
- BareGrep
- GrepWin
其他Grep工具
- dnGrep
回答
FINDSTR非常强大,支持正则表达式,并且具有已经在所有Windows机器上使用的优点。
c:\> FindStr /? Searches for strings in files. FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file] [/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]] strings [[drive:][path]filename[ ...]] /B Matches pattern if at the beginning of a line. /E Matches pattern if at the end of a line. /L Uses search strings literally. /R Uses search strings as regular expressions. /S Searches for matching files in the current directory and all subdirectories. /I Specifies that the search is not to be case-sensitive. /X Prints lines that match exactly. /V Prints only lines that do not contain a match. /N Prints the line number before each line that matches. /M Prints only the filename if a file contains a match. /O Prints character offset before each matching line. /P Skip files with non-printable characters. /OFF[LINE] Do not skip files with offline attribute set. /A:attr Specifies color attribute with two hex digits. See "color /?" /F:file Reads file list from the specified file(/ stands for console). /C:string Uses specified string as a literal search string. /G:file Gets search strings from the specified file(/ stands for console). /D:dir Search a semicolon delimited list of directories strings Text to be searched for. [drive:][path]filename Specifies a file or files to search. Use spaces to separate multiple search strings unless the argument is prefixed with /C. For example, 'FINDSTR "hello there" x.y' searches for "hello" or "there" in file x.y. 'FINDSTR /C:"hello there" x.y' searches for "hello there" in file x.y. Regular expression quick reference: . Wildcard: any character * Repeat: zero or more occurances of previous character or class ^ Line position: beginning of line $ Line position: end of line [class] Character class: any one character in set [^class] Inverse class: any one character not in set [x-y] Range: any characters within the specified range \x Escape: literal use of metacharacter x \<xyz Word position: beginning of word xyz\> Word position: end of word
用法示例:findstr text_to_find *
或者递归搜索findstr / s text_to_find *
回答
ack在Windows上效果很好(如果我们有Perl)。我发现它在很多方面都比grep更好。
回答
Baregrep(Baretail也很好)
回答
Cygwin包含grep。如果我们安装Cygwin,则所有GNU工具和Unix东西都可以在Windows上很好地工作。
http://www.cygwin.com/
回答
PowerShell的Select-String cmdlet在v1.0中很好,但对于v2.0则明显更好。在Windows的最新版本中内置PowerShell意味着我们在这里的技能将总是有用的,而无需先安装某些东西。
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
我发现为Get-ChildItem -Recurse。创建一个函数gcir是很方便的,使用smarts可以正确地传递参数,为Select-String别名是ss。所以你写:
gcir *.txt | ss foo
回答
好吧,在GNU grep的Windows端口旁边,位于:
http://gnuwin32.sourceforge.net/
免费软件Borland的Free C ++编译器(它是带有命令行工具的免费软件)中还提供了Borland的grep(非常类似于GNU)。
回答
UnxUtils是我使用的一种,非常适合我...
回答
它可能不完全属于" grep"类别,但是如果没有名为AgentRansack的实用程序,我将无法在Windows上使用它。这是一个基于gui的"查找文件"实用程序,带有正则表达式支持。右键单击一个文件夹,单击" ransack ..",然后找到包含所需内容的文件,这是非常简单的。也非常快。
回答
我已经在Win32上成功使用了GNU实用程序,并且它具有良好的grep以及win32的tail和其他方便的gnu utils。我避免使用打包的外壳,而只是在win32命令提示符下直接使用可执行文件。
打包的Tail也是一个很好的小应用程序。
回答
我们问这个问题已有两年了,但是我建议我们使用AstroGrep(http://astrogrep.sourceforge.net)。
它是免费的,开源的,并且具有简单的界面。我一直用它来搜索代码。
回答
GrepWin免费和开源(GPL)
我一直在使用由一个tortoisesvn家伙编写的grepWin。在Windows上执行作业...
http://stefanstools.sourceforge.net/grepWin.html