ack is the replacement I wrote for grep, aimed at large trees of heterogeneous code.
Using it will change your life, but why? Here's my top 10 list:
- Searches recursively through directories by default, while ignoring
.svn, CVS and other VCS directories.
- Which would you rather type?
$ grep pattern $(find . | grep -v .svn)
$ ack pattern
- Which would you rather type?
- ack ignores most of the crap you don't want to search
- VCS directories
- blib, the Perl build directory
- backup files like foo~
- binary files
- Lets you specify file types to search, as in --perl or --nohtml.
- Which would you rather type?
$ grep pattern $(find . -name '*.pl' -or -name '*.pm' -or -name '*.pod' | grep -v .svn)
$ ack --perl pattern
- Which would you rather type?
- File-filtering capabilities usable without searching with ack -f. Want a list of all Perl files in a tree? Use ack -f --perl.
- Color highlighting of search results.
- Uses real Perl regular expressions, not a GNU subset.
- Allows you to specify output using Perl's special variables
- Example: ack '(Mr|Mr?s). (Smith|Jones)' --output='$&'
- Many command-line switches are the same as in GNU grep:
-w does word-only searching
-c shows counts per file of matches
-l gives the filename instead of matching lines
etc. - ack is pure Perl, so consistent across all platforms.
- Command name is 25% shorter. :-) Heck, it's 50% shorter compared to grep -r.
To install it, install the Perl module App::Ack. Your coding life will never be the same.
Visit the home page at http://petdance.com/ack
xoxo,
Andy
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Top 10 reasons to start using ack
by diotalevi (Canon) on Nov 30, 2006 at 05:21 UTC | |
by petdance (Parson) on Nov 30, 2006 at 05:28 UTC | |
by diotalevi (Canon) on Nov 30, 2006 at 05:35 UTC | |
by petdance (Parson) on Nov 30, 2006 at 05:37 UTC | |
by diotalevi (Canon) on Nov 30, 2006 at 05:39 UTC | |
| |
Re: Top 10 reasons to start using ack
by Ovid (Cardinal) on Nov 30, 2006 at 13:42 UTC | |
by legLess (Hermit) on Nov 30, 2006 at 17:44 UTC | |
by petdance (Parson) on Dec 01, 2006 at 13:58 UTC | |
Re: Top 10 reasons to start using ack
by duelafn (Parson) on Nov 30, 2006 at 16:01 UTC | |
Re: Top 10 reasons to start using ack
by jmcnamara (Monsignor) on Nov 30, 2006 at 09:07 UTC | |
Re: Top 10 reasons to start using ack
by parv (Parson) on Dec 01, 2006 at 05:28 UTC | |
by jdporter (Paladin) on Sep 14, 2015 at 21:40 UTC | |
Re: Top 10 reasons to start using ack
by Cody Pendant (Prior) on Dec 06, 2006 at 05:49 UTC | |
by petdance (Parson) on Dec 17, 2006 at 05:18 UTC | |
by runrig (Abbot) on Sep 14, 2015 at 22:40 UTC | |
by petdance (Parson) on Sep 15, 2015 at 13:57 UTC |
Back to
Cool Uses for Perl