【发布时间】:2020-10-05 13:48:33
【问题描述】:
我是 python 的初学者。 从日志中,我希望使用 python 仅提取位于每行中间的主机名(在“command_wrappers INFO:”和“:pg_receivewal:切换到时间线”之间),以便向每个那些服务器。
这是日志的行:
2020-07-16 10:13:03,065 [105879] barman.command_wrappers INFO: epgbd-b2bintraextranet: pg_receivewal: switched to timeline 13 at 1F/BC062600
2020-07-16 10:13:03,185 [105877] barman.command_wrappers INFO: epgbd-asteriaconnect: pg_receivewal: switched to timeline 3 at 8/C0066708
2020-07-16 10:13:03,341 [105881] barman.command_wrappers INFO: epgbd-comel: pg_receivewal: switched to timeline 5 at 50/6D04FB30
2020-07-16 10:13:03,352 [105884] barman.command_wrappers INFO: epgbd-dommages-ouvrages: pg_receivewal: switched to timeline 4 at 4C/2605C388
2020-07-16 10:13:03,726 [105888] barman.command_wrappers INFO: epgbd-efs: pg_receivewal: switched to timeline 3 at 50/8C067640
这是我正在寻找的结果:
epgbd-b2bintraextranet
epgbd-asteriaconnect
epgbd-comel
epgbd-dommages-ouvrages
epgbd-efs
有没有简单的方法可以得到这样的结果?
【问题讨论】: