Reputation: 2558
I am using grep like this:
grep -r "foo" * > output.txt
However it seems grep is constantly picking up results from output.txt
which grows indefinitely. How can I prevent this from happening?
Upvotes: 0
Views: 34
Reputation: 1173
See man grep. Then try this:
grep -r "foo" * --exclude=output.txt > output.txt
Upvotes: 2
Reputation: 185530
One solution is :
grep -r "foo" . > ../output.txt
^^
parent directory
Upvotes: 2