in reply to Clearing lines in a file based on an array containing the lines
sub GROOMLDIF { # Delete LDAP-internal fields my @erasethese = qw( structuralObjectClass entryUUID creatorsName modifiersName createTimestamp modifyTimestamp entryCSN ); open my $fh_in , '<', "data/all.ldif" or die "can not open dat +a/all.ldif: $!"; open my $fh_out, '>', "data/groomed.ldif" or die "can not open dat +a/groomed.ldif: $!"; while (<$fh_in>) { my $line = $_; my @thing = (split /:/)[0]; print $fh_out $line unless (grep {$thing eq $_} @erasethese); } }
|
|---|