zgrep rocks

This won’t take long. Promise.

Here’s the thing:

zgrep -i -e 'dn: uid=Y12345' mother-of-all-ldifs.gz

It really is a time saver, you know. Nice thing about the output is that it’s free of the usual grep-talk (you know, when it carries on about this or that thing being a directory and un-searchable).

You can accomplish the same thing with the “traditional method” (or at least one of them):

zcat mother-of-all-ldifs.gz | grep -i 'dn: uid=Y12345'

… but then you’ll have to deal with all that noise in your output.

In experimenting with this my impression is that zgrep is a little slower than the “traditional” method, but if you’ve got over 100 user entries to find in a half dozen or more backup files you’re not going anywhere soon anyway.