Andy Lester is the author of ack, a grep-like text search tool designed for programmers with large trees of heterogeneous source code.
ack searches directories recursively by default while skipping usually undesired directories and files such as version control directories, backup files, binary files etc. Some of its other capabilities and features include highlighting of search results, filtering files without searching them, and using real Perl regular expressions. ack is often used in place of grep.
What inspired you to make ack? How did the project start?
I was tired of writing grep foo $(find . -name '*.pm' | grep -v .svn) to search through all the Perl modules in a project at work. I was refactoring a lot of code, and I was doing the same kind of searches over and over. Sometimes I wanted Perl, sometimes PHP, sometimes HTML, sometimes everything except for Perl, and so on. I wrote the first version of ack to allow me to say ack foo --perl or ack foo --no-php, and it just grew from there.
Why did you choose to write ack in Perl?
Perl is what I've used most for over the past decade, and it has the best regular expressions of any language.
Besides Perl's regular expressions do you feel Perl gives you other advantages in this particular project?
Distributing it via CPAN makes it easy to install for Perl people. They can install the module App::Ack from the CPAN shell. Plus, whenever I upload a new version of ack to CPAN, the CPAN shell tells them there's a new version available.
What are your favorite features of ack?
Whichever one I happen to need most recently. :-)
One feature I wish more tools had was the -1 switch that ack has. The -1 switch tells ack to stop at the first match that it finds. It's for those times where you're searching a big codebase for a single instance of something, and as soon as you find it, you're going to hit Ctrl-C to stop it anyway.
Also, since I'm using the Perl regex engine, the --output option can be handy. It allows you to print only what was matched, or even create output strings that use the $1 match variables.
Personally, what is your most common use case for ack?
Just day-to-day searching through trees of code.
What has been the biggest obstacle or challenge for the ack project so far?
As ack has grown in popularity, everyone has their own pet languages and filetypes that they'd like to see recognized by ack by default. Since ack currently only searches filetypes that it recognizes, this can be a big issue for users. On the other hand, I don't want to add every known computer language to ack's defaults. It raises questions like "Is XML a filetype that should be searched by default?" For some people yes, for others, no.
What will be the biggest change in ack 2.0? How will this change how it is used?
ack's default behavior will change from only searching known filetypes to searching any file that Perl identifies as being text. It's the entire reason I'm calling it 2.0, because it's such a radical change.
Specifying filetypes will also be far more flexible, and I'm looking at allowing plugins, such as to search text in a PDF or Word file, in ack 2.1.
On the ack mailing list you have mentioned erg, a text search tool for non-programmers that would utilize the ack 2.0 code base. How did the idea for erg come about and what is its status?
The ideas that I had for erg have been wrapped up into ack 2.0. I'm not going to have a separate tool.
What development environment do you use for developing ack? i.e. programming editor, OS, etc.
bash and vim, baby!
What are some of your favorite programming books and resources?
My two all-time favorites are Code Complete, 2nd edition by Steve McConnell, and The Pragmatic Programmer
by Andy Hunt and Dave Thomas.
For Perl programming, I recommend Perl Best Practices by Damian Conway and chromatic's Modern Perl
, which is available in electronic form for free at modernperlbooks.com, although of course I bought mine on paper because I like paper.
Higher-Order Perl by Mark Jason Dominus is also fantastic, and was the inspiration for the file-finding iterator in ack.
Recent comments
1 year 36 weeks ago
1 year 36 weeks ago
1 year 37 weeks ago
1 year 37 weeks ago
1 year 37 weeks ago
1 year 37 weeks ago
1 year 37 weeks ago
1 year 37 weeks ago
1 year 37 weeks ago
1 year 37 weeks ago