25 July 2013

Bug/Feature

It's not a bug, it's a feature ;-).

02 July 2013

Ack is Better Than Grep

_   /|
\'o.O'
=(___)=
   U    ack!
Several years ago I discovered ack from hackernews or somewhere like that. If you are a grep user, then you will love ack. Check out Better Than Grep to learn all about it. Ack written in Perl and, therefore, uses Perl regular expressions so it's damn fast compared to grep. So fast it's actually shocking. Below are some steps I used to install it via MacPorts. Please note that I was unable to find it after it was installed so I had to resort to manually creating a symlink to it in my ~/bin directory.
$ sudo port install p5-app-ack
$ which p5-app-ack
$ # No output from which -- so where is it??? 
$ sudo port list p5-app-ack
p5-app-ack                     @2.40.0         perl/p5-app-ack
$ # Well it did install something, so let's look at the contents of the package 
$ sudo port contents p5.12-app-ack
Port p5.12-app-ack contains:
  /opt/local/bin/ack-5.12
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/ConfigDefault.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/ConfigFinder.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/ConfigLoader.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Filter.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Filter/Default.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Filter/Extension.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Filter/FirstLineMatch.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Filter/Inverse.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Filter/Is.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Filter/Match.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Resource.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Resource/Basic.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/App/Ack/Resources.pm
  /opt/local/lib/perl5/vendor_perl/5.12.4/darwin-thread-multi-2level/auto/ack/.packlist
  /opt/local/libexec/perl5.12/ack
  /opt/local/share/perl5.12/man/man1/ack.1pm
$ # Aha! There it is in /opt/local/libexec. I will just symlink to it and be done. 
$ ln -s /opt/local/libexec/perl5.12/ack ~/bin/ack
$ ls -l ~/bin/
total 8
lrwxr-xr-x  1 bruce.snyder  128844131  31 Jul  3 15:32 ack -> /opt/local/libexec/perl5.12/ack
$ ack --version
ack 2.04
Running under Perl 5.12.4 at /opt/local/bin/perl5.12

Copyright 2005-2013 Andy Lester.

This program is free software.  You may modify or distribute it
under the terms of the Artistic License v2.0.
$ # Now I'm good :-) 
Happy Ack'ing.