I'm trying to capture an entire LDAP entry from dn:.+ to the entry's last line, but stopping at last line before next entry, e.g., \n#entry-id: 8266. My trial and error using egrep is getting absolutely nowhere. NOTE: I'm using exported ldif files where the data resides, fwiw.
Closest I've come is with egrep "dn: cn=name,ou=People,dc=example,dc=com.+.|\n*.+\n" but no output on terminal. I've tested the actual regex on regexr.com. I understand that is a completey different env.
Thanks in advance!
Sample Data:
dn: cn=name,ou=People,dc=example,dc=com \
shadowLastChange: 17492 \
userPassword: password \
sn: Last \
givenName: First \
cn: first \
mail: name@example.com \
displayName: First Last \
o: University \
ou: Dept. \
objectClass: top \
objectClass: person
\# entry-id: 8266