With a little side of applesauce...

Friday, November 14, 2008

openLDAP - remove system attributes from LDIF export

I needed to clean the system attributes from a LDIF dump from the old 2.4 server, and used the following line to remove them:
cat good.ldif | grep -v structuralObjectClass: | grep -v entryUUID: | grep -v creatorsName | grep -v createTimestamp: | grep -v entryCSN: | grep -v modifiersName: | grep -v modifyTimestamp: | grep -v entryDN: | grep -v subschemaSubentry: | grep -v hasSubordinates: > good2.ldif

2 comments:

Anonymous said...

# This is a little less power hungry on your cpu

egrep -v "structuralObjectClass:|entryUUID:creatorsName|createTimestamp:|entryCSN:|modifiersName:|modifyTimestamp:|entryDN:|subschemaSubentry:|hasSubordinates:" good.ldif > good2.ldif

Anonymous said...

Thanks! This was just the fix that was keeping my import (add) working. If folks want to be very specific, one can add ^ to the beginning of each pattern to anchor it to the beginning of the line:

slapcat | egrep -v "^entryUUID:|^blah:[|...]" > good.ldif

Thanks!