我拥有数千个日志文件,其中贴有日期-时间印章,记录着某些重要事件。 不幸的是,在任何特定日期-时间印章上记录的信息有时会插入新的字符,这样信息就会在几行中传播。 此外,还有其他与我目的无关的信息没有日期-时间印章。
我得到了一个perl一班的, 做的工作是拉出我想要的信息:
perl -ne print if /^dd:dd:dd.ddd/..!/^dd:dd:dd.ddd/
但是,我想删除首行( 包含日期- 时间戳) 之后的新行字符, 以及以下行中的每一行。 但是, 我确实想在以日期- 时间标记开始的下一行之前保留最后一行之后的新行字符 。
我对如何修改我的单行语来完成这一任务一点运气都没有。