LINUX.ORG.RU

История изменений

Исправление saahriktu, (текущая версия) :

1. It's fast

Ack only searches the stuff that makes sense to search. Perl's regular expressions are highly optimized.

2. It's portable

ack is pure Perl, so it runs on Windows just fine. It has no dependencies other than Perl 5. Installation is a snap.

3. It ignores VCS directories

ack searches recursively by default, while ignoring .git, .svn, CVS and other VCS directories.

Which would you rather type?

$ grep pattern $(find . -type f | grep -v '\.git')

$ ack pattern

4. Better search results

Since ack defaults to only searching source code, you get fewer false positives.

VCS directories, like .git and .svn blib, the Perl build directory backup files like foo~ and #foo# binary files, core dumps, etc

5. Easy filetype specifications

If you have a big project with many different languages combined, it's easy to add --perl to search only Perl files, or use --nohtml to search everything except HTML.

ack's filetype detection means more than just specifying a single file extension.

Which would you rather type?

$ grep pattern $(find . -name '*.pl' -or -name '*.pm' -or -name '*.pod' | grep -v .git)

$ ack --perl pattern

Plus, ack does filetype detection that find can't. ack checks the shebang lines of scripts without extensions.

6. Creates lists of files without searching

Since ack can know to search only, say, Ruby files with the --ruby switch, you can also generate a list of files in a tree with the -f switch.

# List all Ruby files in the tree $ ack -f --ruby > all-ruby-files

7. Match highlighting

ack has flexible match highlighting, where you can specify the colors to use in its output.

8. Perl regular expressions

Perl leads the programming world with its regular expressions. ack uses Perl's regular expressions, not a «Perl-compatible» subset.

You can also take advantage of Perl's match variables. For example, to generate a list of all files #included in your C code, use this:

ack --cc '#include\s+<(.*)>' --output '$1' -h

9. Command switches much like GNU grep

If you know GNU grep, you know most of ack's switches, too. Word-only searching with -w, case-insensitive searching with -i, etc

10. «ack» is shorter than «grep» to type

This one is sort of a joke, but sort of not. You spend hours every day searching through source code. ack makes it as quick and easy as possible to do that searching and to remove as much drudgerous typing as possible.

Defaults matter. The less typing you have to do, the better.

Исходная версия saahriktu, :

1. It's fast

Ack only searches the stuff that makes sense to search. Perl's regular expressions are highly optimized.

2. It's portable

ack is pure Perl, so it runs on Windows just fine. It has no dependencies other than Perl 5. Installation is a snap.

3. It ignores VCS directories

ack searches recursively by default, while ignoring .git, .svn, CVS and other VCS directories.

Which would you rather type?

$ grep pattern $(find . -type f | grep -v '\.git')

$ ack pattern

4. Better search results

Since ack defaults to only searching source code, you get fewer false positives.

VCS directories, like .git and .svn blib, the Perl build directory backup files like foo~ and #foo# binary files, core dumps, etc

5. Easy filetype specifications

If you have a big project with many different languages combined, it's easy to add --perl to search only Perl files, or use --nohtml to search everything except HTML.

ack's filetype detection means more than just specifying a single file extension.

Which would you rather type?

$ grep pattern $(find . -name '*.pl' -or -name '*.pm' -or -name '*.pod' | grep -v .git)

$ ack --perl pattern

Plus, ack does filetype detection that find can't. ack checks the shebang lines of scripts without extensions.

6. Creates lists of files without searching

Since ack can know to search only, say, Ruby files with the --ruby switch, you can also generate a list of files in a tree with the -f switch.

# List all Ruby files in the tree $ ack -f --ruby > all-ruby-files

7. Match highlighting

ack has flexible match highlighting, where you can specify the colors to use in its output.

8. Perl regular expressions

Perl leads the programming world with its regular expressions. ack uses Perl's regular expressions, not a «Perl-compatible» subset.

You can also take advantage of Perl's match variables. For example, to generate a list of all files #included in your C code, use this:

ack --cc '#include\s+<(.*)>' --output '$1' -h

9. Command switches much like GNU grep

If you know GNU grep, you know most of ack's switches, too. Word-only searching with -w, case-insensitive searching with -i, etc 10. «ack» is shorter than «grep» to type

This one is sort of a joke, but sort of not. You spend hours every day searching through source code. ack makes it as quick and easy as possible to do that searching and to remove as much drudgerous typing as possible.

Defaults matter. The less typing you have to do, the better.