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

Re: Cleaning slapcat(1) LDIF output

Jordi Espasa Clofent writes:
> # cleaning the LDIF and dump the results in another file
> $ egrep -ve 
> '^(entryUUID|creatorsName|structuralObjectClass|createTimestamp|entryCSN|modifiersName|modifyTimestamp): 
> '  \ test_backup.ldif > test_backup_cleaned.ldif

Note that long LDIF lines can be split.  A line starting with space
is a continuation of the previous line.  So pass the LDIF file through
   perl -wp00e 's/\r?\n //g'
before doing per-line operations like 'grep' on it.

Should only be relevant in this case for creatorsName or modifiersName
if they're longer than something like 'cn=admin,dc=example,dc=com',
but it's a good habit to get into anyway.