关于Windows的grep工具有什么建议吗?理想情况下,可以利用64位操作系统。
当然,我知道Cygwin,也发现了PowerGREP,但我想知道是否有任何隐藏的宝石在那里?
关于Windows的grep工具有什么建议吗?理想情况下,可以利用64位操作系统。
当然,我知道Cygwin,也发现了PowerGREP,但我想知道是否有任何隐藏的宝石在那里?
当前回答
多年来,我每天都在使用AJC Grep。我发现的唯一主要限制是文件路径被限制在255个字符,当遇到一个字符时它就会停止,而不仅仅是发出警告。这很烦人,但不经常发生。
我在64位的Windows 7 Ultimate上使用它,所以它的64位凭证没问题。
其他回答
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 *
我选择的工具是Windows Grep:
漂亮简单的GUI 支持搜索和替换 能不能给大家展示一下周围找到的线条 可以搜索列在csv和固定宽度的文件
根据评论中的建议,我已经开始使用grepWin,它很棒,而且是免费的。
(我仍然是PowerGREP的粉丝,但我不再使用它了。)
我知道你已经提到了,但是PowerGREP真的很棒。
我最喜欢的功能有:
右键单击一个文件夹,在其中运行PowerGREP 使用正则表达式或文本 为包含和排除的文件指定通配符 搜索和替换 预览模式很好,因为你可以确保你正在替换你想要的东西。
现在我意识到其他grep工具可以完成上述所有工作。PowerGREP只是将所有功能打包到一个非常易于使用的GUI中。
来自给你带来RegexBuddy的那些人,除了喜欢他们的东西,我和他们没有任何联系。(应该注意的是,RegexBuddy包含grep的基本版本(适用于Windows),它的成本比PowerGREP低得多。)
额外的解决方案
现有Windows命令
中 在PowerShell中选择字符串
Windows上的Linux命令实现
Cygwin 现金
Grep工具的图形界面
AstroGrep BareGrep GrepWin
其他Grep工具
dnGrep
我已经成功地使用了一段时间的Win32 GNU实用程序,它有一个很好的grep,以及tail和其他方便的Win32 GNU实用程序。我避免使用打包的shell,而是直接在Win32命令提示符中使用可执行文件。
被包装的尾巴也是一个很好的小应用。
我想要一个免费的Windows grep工具,允许你右键单击一个文件夹,并对每个文件进行正则表达式搜索-没有任何唠叨屏幕。
下面是一个基于前一篇文章中提到的findstr的快速解决方案。
在硬盘上的某个地方创建一个文本文件,用于保存长寿命工具。重命名为.bat或.cmd,并将以下文件粘贴进去:
@echo off
set /p term="Search term> "
del %temp%\grepresult.txt
findstr /i /S /R /n /C:"%term%" "%~1\*.*" > "%temp%\grepresult.txt"
start notepad "%temp%\grepresult.txt"
然后浏览到SendTo文件夹。在Windows 7上浏览到%APPDATA%\Microsoft\Windows\SendTo并将批处理文件的快捷方式拖到该SendTo文件夹中。
我将快捷方式重命名为1 GREP,以使其保持在SendTo列表的顶部。
我接下来要做的事情是将findstr的输出通过生成html文件的东西输送,这样您就可以单击每个输出行来打开该文件。而且,我不认为它在文件夹的快捷方式上起作用。我必须检查参数,看看它是否包含“.lnk”。