[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldapseaarch goes newline with long lines



> Hello,
>
> whe have lines in our ldap db that are longer then 80 characters.
> When I search them with ldaspsearch and redirect them to a file with >,
> then newlines are added after the 78th character.
>
> This is a problem, because other tools don't like lines that are
> splittet up ( in this case oranames )
>
> Is there a way to change this behaviour of ldapsearch or is there a way
> to tell ldapsearch that the lines can be longer, say 200 columns ?

Short: no, no.  ldapsearch(1) writes output according to LDIF1 (RFC2849)
which, according to note (2) allows folding values at any char; ldapsearch
chooses colum 78 as the last one.  You may unfold values by using an
appropriate postprocessing of ldapsearch output, e.g. an awk script
like

/^dn: / {
    prev = $0;
    while ($1 != "") {
        getline;
        if (substr($0,1,1) == " ") {
            prev = prev substr($0,2,length($0)-1);
        } else {
            print prev;
            prev = $0;
        }
    }
    print "";
}

p.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it