redirected output out of control

David Kramer david at thekramers.net
Sat Apr 1 14:21:55 EST 2006


John Kirby wrote:
> Hi BLU,
> 
> Maybe this is a newbie error and I've been lucky not to encounter it before, 
> but your feedback is appreciated.
> 
> I ran a command and unintentionally created an enormous text file that ate up 
> all the gigs of open space on the server:
> find -print0 | xargs -0 grep -i blah > blahInstances.txt
> 
> I'm puzzled because when I ran the output to the screen, it was only something 
> like 1000 lines and it quit like I expected. What's also strange to me is 
> that I ran the command on my local suse 9.3 box and it didn't get caught up 
> and generate a huge file. It ran as expected. Not sure exactly what OS 
> version is on the machine that had the issue.
> 
> My main confusion is why running output to the screen would be fine, but 
> running it to the file would get caught in a loop or something similar.

Some commands do act differently when stdout is not a console.  I don't
think grep is one of them.

But the obvious thing to do here is to look at the top 100 and bottom
100 lines of the file, and look at the top 100 and bottom 100 lines of
console output, and find out what's different.  *Then* figure out why.



More information about the Discuss mailing list