我有日志文件。我想从特定行中提取电子邮件列表。示例日志文件:
05:06:48,311 INFO http-nio-8080-exec-81 controller.IndexController:221 - Attempt to login: [[email protected]]. Headers: ["content-length": "52", ...]
15:06:48,311 INFO http-nio-8080-exec-81 controller.IndexController:221 - Attempt to login: [[email protected]]. Headers: ["content-length": "52", ...]
09:40:21,187 INFO http-nio-8080-exec-31 security.AuthAuthenticationProvider:81 - User: [16167]. Wrong code. Telegram: [0]. Google: [0]
我的脚本:
cat file.log | sed -r 's/.*Attempt to login: \[(.*)\]\..*/\1/' | sort | uniq > file.log.filtered.txt
我得到 file.log.filtered.txt:
09:40:21,187 INFO http-nio-8080-exec-31 security.AuthAuthenticationProvider:81 - User: [16167]. Wrong code. Telegram: [0]. Google: [0]
[email protected]
为什么我在过滤文件中有“AuthAuthenticationProvider”行?