[转]GREP for Windows

本文介绍了一个针对Windows环境修改过的GNU grep 2.0版本,该版本新增了搜索子目录的功能,解决了之前版本中无法递归搜索的问题。此外,文章还提到了一些重要的修订,包括如何正确显示文件名和路径等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://www.interlog.com/~tcharron/grep.html

A very flexible grep for windows

GREP is a well known tool in the unix environment. There are several ports available that I came across for Windows. However, NONE of them allowed me to search through subdirectories (this functionality is easy on unix using the shell's file manipulation tools). I modified GNU grep 2.0 to allow searching of subdirectories.

To search subdirectories, do something like this:

grep -S "searchtext" *.txt
grep -S "searchtext" \personal\files\*.txt
grep -S searchtext C:\*.*

The most recent version I compiled is GREP20d_WIN.ZIP. It was released on January 26, 2001.

Revisions (Jan 26, 2001)

  • 2.0b Fixed display of filenames (-h option, as well as decision to print them based on number of files being checked)
  • 2.0c Fixed display of paths if the "-l" option was used with wildcards
  • 2.0d Jan 26, 2001
    • Fixed display of paths if the "-c" option was used with wildcards
    • Changed code to accept standard in from piped output. With earlier versions, the "-" was required to expicitly indicate that redirection was being used.

Note
Versions before 2.0d did not work well with redirection, such as:

dir *.* /sub | grep -i DLL | more

This will nearly always cause a crash with versions of grep/windows before 2.0d. In these cases, use explicit rediretion, or upgrade to version 2.0d. The explicit redirection syntax is:

dir *.* /sub | grep -i DLL - | more

This page has been accessed

&ft=6&frgb=snow&md=6&pad=Y&dd=AA"> -->

times since November 17, 1997.

转载于:https://www.cnblogs.com/horizonli/p/grep.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值