Есть ли что-нибудь, что grep делает лучше, чем ack?

310
Luiz Berti

Я начал использовать ackнекоторое время назад, и это удивительно, но все еще напрашивается вопрос:

Есть ли что-нибудь grepеще лучше, чем ack?

Или, может быть, есть что-то grep, что ack не может сделать ?

1

3 ответа на вопрос

1
Jakke

You should have a look at the man page and it will tell you:

WHEN TO USE GREP ack-grep trumps grep as an everyday tool 99% of the time, but don't throw grep away, because there are times you'll still need it. E.g., searching through huge files looking for regexes that can be expressed with grep syntax should be quicker with grep. If your script or parent program uses grep "--quiet" or "--silent" or needs exit 2 on IO error, use grep. 
Это очень интересно, однако мне все еще интересны вещи, которые они оба делают, но "grep" превышает, или вещи, которые "ack" не может сделать, но grep может ... Я уверен, что здесь гораздо больше, чем " мужская страница. Luiz Berti 9 лет назад 0
1
Andy Lester

If you're searching binary files, then you must use grep because ack will ignore them, always.

When searching through a few large files, grep will be faster than ack.

It sounds like you're trying to decide if you should abandon grep and use ack all the time, and I suggest that you should not. You should use both grep and ack when it's appropriate. Basically, ack is for searching source code, and grep is for general-purpose searching.

0
Ask and Learn

ack is not part of default installation on all Linux/Unix server but grep is. Have you tried the_silver_searcher or the_platinum_searcher. They both run faster than ack

Похожие вопросы