Ack to the future!

Ack to the future!

Why you should use ack, and what's coming in ack 2.0 and beyond.

D1588981e0248aaa0174906c99df180e?s=128

Andy Lester

June 14, 2012
Tweet

Transcript

  1. 1.

    ack to the future Andy Lester & Rob Hoelz YAPC::NA

    2012, June 14, Madison, WI Thursday, June 14, 12
  2. 6.

    Recognizes filetypes • --perl matches *.pm, *.pl, *.t • and

    scripts without extensions that begin with a #!...perl shebang line • Same with Python, PHP, Ruby, etc Thursday, June 14, 12
  3. 7.

    Ignores junk • .git, .svn, .hg, etc • coredumps •

    binary files • blib, _build, nytprof • *~ backups Thursday, June 14, 12
  4. 8.

    Perl regexes • True Perl regexes, not PCRE. • Use

    $1, $&, etc ‣ ack '#include\s*"(.+)"' --output='$1' Thursday, June 14, 12
  5. 9.

    Portable, Windows • Works back to Perl 5.8.8 • Only

    one dependency, File::Next • Works on Windows when you have no other Unixy tools Thursday, June 14, 12
  6. 10.

    Easy install • Install as App::Ack from CPAN • -or-

    • Install a package (might be "ack-grep" for your distro) • -or- • DL single file from betterthangrep.com Thursday, June 14, 12
  7. 13.

    Optimized for laziness • Typing grep switches is slow •

    DIY aliases + shell configs are not portable Thursday, June 14, 12
  8. 19.

    Flexible file/dir selectors • Making types is easier! • --type-add=make:match:/^[mr]akefile/i

    • --type-add=perl:firstlinematch:/perl/ • Making exclusions is easier! • --ignore-file=Makefile.PL • --ignore-dir=cache/ Thursday, June 14, 12