Reputation: 377
Why does grep -w
take so much longer than a simple grep
?
Upvotes: 1
Views: 44
Reputation: 1442
grep -w
matches whole words, not just 'hits' like the normal grep
. This is achieved by applying regular expressions on the input. Regular expressions are by nature a really expensive technique and should always be used with caution.
Upvotes: 2