关于Windows的grep工具有什么建议吗?理想情况下,可以利用64位操作系统。
当然,我知道Cygwin,也发现了PowerGREP,但我想知道是否有任何隐藏的宝石在那里?
关于Windows的grep工具有什么建议吗?理想情况下,可以利用64位操作系统。
当然,我知道Cygwin,也发现了PowerGREP,但我想知道是否有任何隐藏的宝石在那里?
当前回答
根据评论中的建议,我已经开始使用grepWin,它很棒,而且是免费的。
(我仍然是PowerGREP的粉丝,但我不再使用它了。)
我知道你已经提到了,但是PowerGREP真的很棒。
我最喜欢的功能有:
右键单击一个文件夹,在其中运行PowerGREP 使用正则表达式或文本 为包含和排除的文件指定通配符 搜索和替换 预览模式很好,因为你可以确保你正在替换你想要的东西。
现在我意识到其他grep工具可以完成上述所有工作。PowerGREP只是将所有功能打包到一个非常易于使用的GUI中。
来自给你带来RegexBuddy的那些人,除了喜欢他们的东西,我和他们没有任何联系。(应该注意的是,RegexBuddy包含grep的基本版本(适用于Windows),它的成本比PowerGREP低得多。)
额外的解决方案
现有Windows命令
中 在PowerShell中选择字符串
Windows上的Linux命令实现
Cygwin 现金
Grep工具的图形界面
AstroGrep BareGrep GrepWin
其他Grep工具
dnGrep
其他回答
GREP for Windows
我一直在用它,幸运的是它仍然可用。它非常快,非常小。
PowerShell的Select-String类似。它没有相同的选项和语义,但仍然很强大。
Cygwin包含grep。如果你安装了Cygwin,所有的GNU工具和Unix的东西在Windows上都工作得很好。
我总是使用WinGREP,但是我遇到过它不能释放文件的问题。
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 *