4 ms·
Why is: ack -C5 'scope(?!.*lambda)' app/models Better than: grep -C5 scope app/models | grep -v lambda ?
by carbocation 14y ago
Why is:
ack -C5 'scope(?!.*lambda)' app/models
Better than:
grep -C5 scope app/models | grep -v lambda
?
- helper 14y agoAgreed. The article says: $ grep needle haystack|grep silver This sucks. It would be nice if the argument against this had some sort of substance. In most cases grep is going to be faster that ack. If you are searching large files this can make quite a difference.
- anonymoushn 14y agoThe first one gets you five lines around all of the scopes without lambdas. The second one gets you five lines around all the scopes (including those with lambdas) and then omits all of the lines with lambdas, some of which will have caused a match in the first grep, and some of which may be part of the context of matches in the first grep. You will get both contexts with no match in the middle and matches with incomplete contexts.
- carbocation 14y agoQuite right. The downfalls of posting untested code...