It's probably best to use an appropriate module for this. Net::LDAP::LDIF appears to normalize the entries. I haven't used perl-ldap much myself but as far as I know it's a very good module for LDAP.
use warnings; use strict; use Net::LDAP::LDIF; my $ldif = Net::LDAP::LDIF->new("test.ldif", "r", onerror=>'die'); while ( not $ldif->eof ) { my $entry = $ldif->read_entry; print $entry->ldif; } $ldif->done;
Given the following input, the last three lines before the dash are transformed into one line "foo: BarTest123Blah", which I guess is what you want?
dn: cn=Test,ou=Foo,o=Bar,c=US changetype: modify replace: foo foo: Bar Test123 Blah -
In reply to Re: Perl question about manipulation of LDIF file
by haukex
in thread Perl question about manipulation of LDIF file
by Anand1974
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |