Hi
I'm trying to transform one LDIF file into another format but I have trouble understanding awk even after reading several tutorials. Any ideas on how to do it? Thanks.
I have one file that basically looks like this:
# Add new values: addressBookContainer
dn: cn=Address-Book-Container,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchAddressListOU
mayContain: msExchEnableInternalEvaluator
mayContain: msExchMinAdminVersion
-
# Add new values: computer
dn: cn=Computer,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: logRolloverInterval
mayContain: monitoredConfigurations
mayContain: monitoredServices
-
and I need it to look like this, every mayContain must have the lines:
"changetype: ntdsschemamodify
add: mayContain:"
before it and on the line after it it must have:
"-"
# Add new values: addressBookContainer
dn: cn=Address-Book-Container,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchAddressListOU
-
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchEnableInternalEvaluator
-
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchMinAdminVersion
-
# Add new values: computer
dn: cn=Computer,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: logRolloverInterval
-
changetype: ntdsschemamodify
add: mayContain
mayContain: monitoredConfigurations
-
changetype: ntdsschemamodify
add: mayContain
mayContain: monitoredServices
-
If that is not possible then each mayContain can look like this:
dn: cn=DN_FROM_THE_RECORDS_FIRST_LINE,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: logRolloverInterval
-
I'm trying to transform one LDIF file into another format but I have trouble understanding awk even after reading several tutorials. Any ideas on how to do it? Thanks.
I have one file that basically looks like this:
# Add new values: addressBookContainer
dn: cn=Address-Book-Container,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchAddressListOU
mayContain: msExchEnableInternalEvaluator
mayContain: msExchMinAdminVersion
-
# Add new values: computer
dn: cn=Computer,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: logRolloverInterval
mayContain: monitoredConfigurations
mayContain: monitoredServices
-
and I need it to look like this, every mayContain must have the lines:
"changetype: ntdsschemamodify
add: mayContain:"
before it and on the line after it it must have:
"-"
# Add new values: addressBookContainer
dn: cn=Address-Book-Container,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchAddressListOU
-
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchEnableInternalEvaluator
-
changetype: ntdsschemamodify
add: mayContain
mayContain: msExchMinAdminVersion
-
# Add new values: computer
dn: cn=Computer,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: logRolloverInterval
-
changetype: ntdsschemamodify
add: mayContain
mayContain: monitoredConfigurations
-
changetype: ntdsschemamodify
add: mayContain
mayContain: monitoredServices
-
If that is not possible then each mayContain can look like this:
dn: cn=DN_FROM_THE_RECORDS_FIRST_LINE,cn=Schema,cn=Configuration,dc=X
changetype: ntdsschemamodify
add: mayContain
mayContain: logRolloverInterval
-