Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Mar 2007 01:14:43 +0300
From:      Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To:        Garrett Cooper <youshi10@u.washington.edu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Possible grep(1) bug or user error :)?
Message-ID:  <20070317221443.GD82045@codelabs.ru>
In-Reply-To: <45FC61FF.3090009@u.washington.edu>
References:  <45FC61FF.3090009@u.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
Garret,

Sat, Mar 17, 2007 at 02:47:43PM -0700, Garrett Cooper wrote:
> I was recently grepping a directory and outputting to a file located in the 
> same directory as follows:
> 
> grep -ri {key} * > {key}.found
> 
> The thing is that grep kept on feeding off of the {key}.found file and 
> eventually ate up all the free space on the device (~12GB).

And what you expected? The file {key}.found was created prior to the
expansion of '*', so grep was parsing that file and feeding it with
the messages about the lines with {key} that were found. And these
lines also provoked grep to add more lines about the {key} found, and
so on. I think you got the idea of the infinite cycle you created.
-- 
Eygene



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070317221443.GD82045>