#!/usr/bin/perl $USAGE = "Usage: $0 your_ldif_input_file [ldif_output_file]\n"; $input_file = shift || die $USAGE ; $output_file = shift || ’-’; # write to STDOUT by default local $/ = ""; # set the record separator to paragraph mode open(OUTFH, ">$output_file") || abort("ERROR: Unable to open $output_file for writing"); open(LDIFFILE, "$input_file") || abort("ERROR: Unable to open $input_file for reading "); while (defined($_ = )) { s/\n //g; # unfold the lines next unless ( $_ =~ /o=NetscapeRoot\n/); # skip unless o=netscaperoot next if (s/slapd-//g); # skip slapd entries s/\nuniquemember: cn=Netscape Directory Server//g; # rm this unique member next if (s/Netscape Directory Server//g); # skip Dir Server entries s/Server Group/Migrated Server Group/g; # change the server group print OUTFH "$_" ; # print to the output file } close (LDIFFILE); close (OUTFH); undef $/;