20120302 zgrep rocks - plembo/onemoretech GitHub Wiki

title: zgrep rocks link: https://onemoretech.wordpress.com/2012/03/02/zgrep-rocks/ author: lembobro description: post_id: 2295 created: 2012/03/02 15:08:39 created_gmt: 2012/03/02 19:08:39 comment_status: closed post_name: zgrep-rocks status: publish post_type: post

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.

Copyright 2004-2019 Phil Lembo