Hi there,
I'm still pretty novice to bash, but I have some experience in manipulating data per line by using the 'while read' structure and for example extracting some data with awk and such.
Now I have an ldif file, which has data in it per paragraph (separated by a newline). Now I want to extract data from it (different attributes in it) per ldif record, which is harder cause there is no 'read paragraph' of course.
Example, if I have an ldif file like this:
dn: uid=test1,cn=example,cn=dom
time: 20110822105940
modifyTimestamp: 20110822085944Z
dn: uid=test2,cn=example,cn=dom
time: 20110822105941
modifyTimestamp: 20110822085945Z
dn: uid=test3,cn=example,cn=dom
time: 20110822105942
modifyTimestamp: 20110822085946Z
I want to be able to do checks and compares of attributes in every record, like comparing time and modifyTimestamp, but I need to do it in all of the records (skip none) and I would like it generic enough so I'm able to use it in a for or while loop and, say, grep the data out of it.
I'm sure there are cool solutions for this in sed or awk and I hope I can learn from it how it's done and I can try to use it to my own liking.
Thanks in advance!