Created
March 23, 2015 16:47
-
-
Save blaxter/60ef4836f341df0cd183 to your computer and use it in GitHub Desktop.
ldap filter pretty print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! perl -slw | |
use strict; | |
( my $input = do{ local $/; <DATA> } ) =~ tr[\n][]d; | |
my $tab = 0; | |
$input =~ s[([()])]{ | |
$tab-- if $1 eq ')'; | |
my $modified = "\n" . ( " " x $tab ) . $1; | |
$tab++ if $1 eq '('; | |
$modified; | |
}ge; | |
$input =~ s[\n\s+\)][)]g; | |
print $input; | |
__DATA__ | |
(& (mailnickname=*) (| (&(objectCategory=person)(objectClass= | |
user)(!(homeMDB=*))(!(msExchHomeServerName=*)))(&(objectCategory=person)(obje | |
ctClass=user)(|(homeMDB=*)(msExchHomeServerName=*)))(&(objectCategory=person) | |
(objectClass=contact))(objectCategory=group)(objectCategory=publicFolder)(obj | |
ectCategory=msExchDynamicDistributionList) )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ez