[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-grep] Re: Grep for Windows bug report

From: Julian Foad
Subject: [bug-grep] Re: Grep for Windows bug report
Date: Sun, 16 Jan 2005 14:01:22 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a5) Gecko/20041122

El-Shamaa, Khaled (ICARDA) wrote:
At first I would like to thanks you for your effort in making great grep
tool available in windows OS, but while I use it I faced a bug I want to
report it:

Thanks for the praise.

Grep now has its own mailing list <address@hidden> so I am copying this reply there.

When I try to save grep output command into file I fail in the endless
loop, I used a command like this (I use it to grep postnuke modules
information in one click):

grep -R -E "modversion.'(name'|version'|contact')" * > modules.txt

I think the problem you have is not a bug in Grep. You asked Grep to find text in all the files in the current directory, while asking the operating system to put the result into a file called "modules.txt" in the current directory. The way the operating system works is it creates "modules.txt" as an empty file in the current directory before it runs "grep", and therefore Grep searches in that file as well as the other files. Each time it finds a matching line in any file including modules.txt, a copy of the matching line gets added to the end of modules.txt, and so the result is an endless loop as modules.txt grows until the disk is full.

As for solutions ... you could use Grep's "--exclude=modules.txt" option, or you could write the result to a a file in a different directory.

I hope this helps.

- Julian

reply via email to

[Prev in Thread] Current Thread [Next in Thread]