Thank you Ack!

People may have noticed my absence from the Perl world lately. I have been writing my Ph.D. thesis (179 pages on Ultrafast Electron Microscopy with my Physics::UEMColumn Perl module featured) and defense.

Ack is a tool for searching code and text. It works much like the unix tool grep, although it is imbued with the power of Perl. To mark the release of Ack 2.0 though I wanted to mention a few one-liners that made my life easier in this stressful time.

My thesis is written in many LaTeX files and one can probably imagine that searching those files was needed regularly. The biggest is for finding non-ascii characters. As I add content from old publications or external programs, lots of non-ascii characters can often come along for the ride. LaTeX is a very old program, well pre-dating unicode, and it has a very different way of adding special characters with its own markup. In fact parts of the compiling toolchain croak with unicode characters. So I found myself using

ack '[^[:ascii:]]'

regularly. Also I had to keep a list of all the abbreviations that I had used in the paper, but of course you forget if you have them all. I used this little bash-ack conglomeration to find all sequences of two or more upper-case characters, which is how I write my abbreviations,

ack -ho '\p{Upper}{2,}' | sort | uniq

I’m sure I used many other little ackings here and there, but these were the two I could remember off-hand. Thanks to Andy and everyone who has contributed to ack!

Now go use it to make your life easier!

Visit the new site:


BTW, XeTeX uses UTF-8 source files (probably not relevant to your thesis :-).

Can we assume that it was a successful defense, given you’re mentioning it in public?

FYI, you can optionally use \P{ASCII} instead of [^[:ascii:]] and \p{Lu} instead of \p{Upper}. The ASCII one is clearly more readable and they’re both less characters to type for one-liners. Lu and Upper are both just abbreviations for Uppercase_Letter.

Just packaged up makebeamerinfo for SprezzOS — appreciate the quality work! Congrats on the upcoming defense! I wonder if you know my buddy Nick Bronn up at UIUC, doing solid state? Tell him toast says hey.

Leave a comment

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.