LDAP: Inhibiting line-wrap in ldapsearch output


LDIF (LDAP data interchange format), defined in rfc2849, lines may be folded by inserting a line-separator character and a space, except between bytes of a multi-byte UTF-8 character:

ldapsearch --port 11389 \
 --bindDn cn=RootDn \
 --bindPassword password \
 --baseDn uid=user.0,ou=people,o=training '(&)' description
dn: uid=user.0,ou=People,o=training
description: trdrrlpmyyvydmyufhiolxmymkukhstjqdjdatbfbjfatanrihdaxffitkmkppuwcmj
 ihurisjundxbuobkjonekajhqiosmxibbwpxpcctyhahyqbzrnbhchzlzofezmufxvukevmcmwevsqy
 rhoxtenvqdkywcwryerwucfkudyiaadfmoldcwretzwiqfqdtyuhihdnncxfjyfyxfjqtwwfhkxqtxe
 pvpejrvwkrwymkfwjupsfksktarwhqkbdlercyuytwiwswwinqeavxzfrpkevdmmbnwxzxoxxjwihyl
 oznzkbfaveyuxuevnnjmqvmynxhvulrwfeadzvdwfamttqknnzfmtvuqkacmvdisnyzsinvawaxxkbz
 sielcckfwlifvifssttzekvxcijfdeseruzbyvujrxmpeowfvceevaxowtqaehyynusxtorqokhoqmz
 abijlebckmsiykcizvfeftyuqzktvkoqxlqvffzqawlrwmzzkcdxaqtfmknbotwonkzbwmimwmxpoam
 wtcujxuurikkdkjqhkzzkzrptewrqrnnoilkvbuvbxwcpvxjtrloctkqetyfebmpefzklnqibotvxsr
 waeoclszymenimcwsdybhdyyqovmrwtketcqqrrtixocykthdcbdnvikhlfphodhqmfhyymtevokcll
 ztabwjqssqlwfvaedsdxjcbzllhbtzvkjfpvdbdsfhtlzwrvubwrbfifldzylieufkfxubituebpmia
 ryyszorewfnyuaicfqkfdrufdssuuxmkdhttytoibntfrcszcxztdnnuaxqfkobchqkmwihlywfdbub
 wmzaqrkrwcxmvuxmmbhnkpfuwuasfixsufmqhuvlcmdhikysudclotfcipdkxpijkbpaukmrrbkdskb
 eeonaeqknszfsnscfcfoixuqivbxudmdfjyutdnqamhhhmolmklldkjanhmykshflpljtmozkvcvdmj
 psmbojuzp

Use the --dontWrap command-line option to ldapsearch to prevent the lines from being folded:

ldapsearch --port 11389 \
 --bindDn cn=RootDn \
 --bindPassword password \
 --baseDn uid=user.0,ou=people,o=training \
 --dontWrap '(&)'  description
dn: uid=user.0,ou=People,o=training
description: trdrrlpmyyvydmyufhiolxmymkukhstjqdjdatbfbjf ...

The same thing can be accomplished with the legacy Solaris ldapsearch tool by using the '-T' command line option. The legacy OpenLDAP ldapsearch tool had a '-r' for the same purpose, but that seems to have gone away.

About Terry Gardner

Terry Gardner was a leading directory services architect with experience with many large scale directory services installations and messaging server installations, and was a Subject Matter Expert in the field of Directory Services and Solaris (operating system) performance. Mr. Gardner also participated in the open-source software community. Mr. Gardner passed away in December, 2013.
This entry was posted in LDAP, UnboundID and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s