【发布时间】:2021-09-29 03:45:40
【问题描述】:
我正在尝试捕获从 dn:.+ 到条目最后一行的整个 LDAP 条目,但在下一个条目之前的最后一行停止,例如,\n#entry-id: 8266。我使用 @987654322 的试验和错误@绝对无处可去。注意:我正在使用数据所在的导出 ldif 文件,fwiw。
我最接近的是egrep "dn: cn=name,ou=People,dc=example,dc=com.+.|\n*.+\n",但终端上没有输出。我已经在 regexr.com 上测试了实际的正则表达式。我知道这是一个完全不同的环境。
提前致谢!
样本数据:
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
【问题讨论】:
-
LDAP 条目没有行。因此,不存在多行 LDAP 条目之类的东西。您实际上在谈论的是 LDAP 条目的 LDIF 表示。但是您提供的示例在逻辑上只包含一行,因为行终止符转义反斜杠。