I have bash script that does this: hostDN=( $(ldapsearch .... | grep '^dn' | cut -d ' ' -f 2) ) The problem is that if the 'dn' line is too long, ldapsearch splits it to several lines according to LDIF rules.
Is there any way to tell ldapsearch not to split lines (or does it depends on server side?)
Hai Zaar wrote:
I have bash script that does this: hostDN=( $(ldapsearch .... | grep '^dn' | cut -d ' ' -f 2) ) The problem is that if the 'dn' line is too long, ldapsearch splits it to several lines according to LDIF rules.
Is there any way to tell ldapsearch not to split lines (or does it depends on server side?)
AFAIK there is not. And if got RFC 2849 right, there is no need for splitting, so I would also appreciate an optional parameter. (A fourth "-L" might be good for that purpose or an numerical operator to specify custom wrapping)
However, joining the lines is not that complicated.
A
Adam Pordzik wrote:
Hai Zaar wrote:
I have bash script that does this: hostDN=( $(ldapsearch .... | grep '^dn' | cut -d ' ' -f 2) ) The problem is that if the 'dn' line is too long, ldapsearch splits it to several lines according to LDIF rules.
Is there any way to tell ldapsearch not to split lines (or does it depends on server side?)
AFAIK there is not. And if got RFC 2849 right, there is no need for splitting, so I would also appreciate an optional parameter. (A fourth "-L" might be good for that purpose or an numerical operator to specify custom wrapping)
Yet another case where using a decent scripting language with an appropriate LDIF module would do the job with less hassle. Or even better doing the job directly with an LDAP module.
This is a general topic better discussed on ldap@umich.edu list.
Ciao, Michael.
On Wednesday 15 November 2006 16:44, Hai Zaar wrote:
I have bash script that does this: hostDN=( $(ldapsearch .... | grep '^dn' | cut -d ' ' -f 2) ) The problem is that if the 'dn' line is too long, ldapsearch splits it to several lines according to LDIF rules.
If I need to do something like this on the shell, I typically use something like:
ldapsearch|perl -p0e 's/\n //g'|awk -F: '/^dn/' '{print $2}'
Is there any way to tell ldapsearch not to split lines (or does it depends on server side?)
Not at present, some patches were proposed in some ITSs, but no agreement was reached on their usefulness (IIRC).
Regards, Buchan
2006/11/16, Buchan Milne bgmilne@staff.telkomsa.net:
If I need to do something like this on the shell, I typically use something like:
ldapsearch|perl -p0e 's/\n //g'|awk -F: '/^dn/' '{print $2}'
Thanks, I've tried to do the same with sed - did not work.
Not at present, some patches were proposed in some ITSs, but no agreement was reached on their usefulness (IIRC).
Ok, I get it. It looks like I've got all of the answers. Thank you.
openldap-software@openldap.org