多行成单行输出到logging器

我有一个日志文件,其中的数据条目如下每个条目以时间开始:

time: 20170509123420 dn: uid=abc,ou=People,dc=test,dc=example,dc=com changetype: modify replace: passwordAllowChangeTime replace: passwordExpirationTime replace: passwordRetryCount replace: pwdpolicysubentry replace: modifiersname modifiersname: uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoot replace: modifytimestamp modifytimestamp: 20170509113420Z time: 20170509123621 dn: cn=nsPwPolicyContainer,dc=test,dc=example,dc=com changetype: add objectClass: nsContainer objectClass: top cn: nsPwPolicyContainer creatorsName: uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoot modifiersName: uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoo 

现在我想打印为单行,只有时间之间的条目: 例如,时间之后,我想把所有logging打印成单行,所以在我的情况下,它应该打印

 time: 20170509123420 dn: uid=abc,ou=People,dc=test,dc=example,dc=com changetype: modify replace: passwordAllowChangeTime - replace: passwordExpirationTime - replace: passwordRetryCount - replace: pwdpolicysubentry - replace: modifiersname modifiersname: uid=admin,ou=administrators,ou=topologymanagement,o=netscaperoo t - replace: modifytimestamp modifytimestamp: 20170509113420Z 

我曾尝试用下面的表扬,它显示在屏幕上,但尝试redirect/追加它不工作。

 tailf /var/log/dirsrv/slapd-ldap/audit | awk '/^time:/ {if (NR!=1)print"";printf $0}{printf $0}END{print"";}' | logger 

有没有这样的命令?

也许你可以尝试这样的事情:

 awk '/^time:/ { print "\n" } { printf "%s ",$0 }' /var/log/dirsrv/slapd-ldap/audit > logger