When you are using ldapsearch to find quickly some informations in LDAP directory, there are some problems.
For instance, with this command :
ldapsearch -x -LLL -h myldaphost -b 'ou=myldapbase,...'
Just "pipe" the result in this Perl filter :
ldapsearch ... | perl -MMIME::Base64 -MEncode=decode -n -00 -e 's/\n +//g;s/(?<=:: )(\S+)/decode("UTF-8",decode_base64($1))/eg;print' [or] ldapsearch ... | perl -MMIME::Base64 -MEncode=decode -n -00 -e 's/\n +//g;s/(?<=:: )(\S+)/decode("UTF-8",decode_base64($1))/eg;print if /Be +yoncé/'
This way, the Lord of the Rings can see the entire block (LDAP entry) matched by the regex you want (a single lady, in this example).
Warning : the output is NOT LDIF-compatible, it's just 'text'.
update : depending of your context (locale with or without UTF-8), you can simplify the command-line, like this:
ldapsearch ... | perl -MMIME::Base64 -n -00 -e 's/\n //g;s/(?<=:: )(\ +S+)/decode_base64($1)/eg;print' [or] ldapsearch ... | perl -MMIME::Base64 -n -00 -e 's/\n //g;s/(?<=:: )(\ +S+)/decode_base64($1)/eg;print if /Beyoncé/'
In reply to Readable ldapsearch output by brx
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |