【发布时间】:2018-10-10 17:22:30
【问题描述】:
我有一个包含以下形式数据的文件:
7/26/2018 10:01:52.084 MULTITHREAD APP It goes to preserve the context of the destination window LAESVEES03ES0301C when setting the origin data DATA_ENTRY
"n lines"
7/26/2018 12:15:51.512 AWT-EventQueue-0 **Protecting** graphical interface
7/26/2018 12:17:00.121 MULTITHREAD APP It goes to preserve the context of the destination window LARTVERT31RT3111C when setting the origin data DATA_ENTRY
7/26/2018 12:52:48.681 MULTITHREAD APP **Unprotecting** graphic interface
"n lines"
7/26/2018 14:00:51.512 AWT-EventQueue-0 **Protecting** graphical interface
7/26/2018 14:35:35.230 MULTITHREAD APP It goes to preserve the context of the destination window LAPEVEBIOMBIOM03C when setting the origin data DATA_ENTRY
7/26/2018 14:52:48.681 MULTITHREAD APP **Unprotecting** graphic interface
"n lines"
7/26/2018 15:00:51.512 AWT-EventQueue-0 **Protecting** graphical interface
7/26/2018 15:11:19.100 MULTITHREAD APP It goes to preserve the context of the destination window LAPEVEPE27PE2701C when setting the origin data DATA_ENTRY
7/26/2018 15:22:48.681 MULTITHREAD APP **Unprotecting** graphic interface
"n lines"
7/26/2018 15:00:51.512 AWT-EventQueue-0 **Protecting** graphical interface
7/26/2018 15:11:19.100 MULTITHREAD APP It goes to preserve the context of the destination window LARTVEIT29IT2901C when setting the origin data DATA_ENTRY
7/26/2018 15:22:48.681 MULTITHREAD APP **Unprotecting** graphic interface
"n lines"
7/26/2018 15:30:53.512 AWT-EventQueue-0 Protecting graphical interface
7/26/2018 15:41:19.100 MULTITHREAD APP It goes to preserve the context of the destination window LAPEVEPE27PE2701C when setting the origin data DATA_ENTRY
7/26/2018 15:49:48.681 MULTITHREAD APP Unprotecting graphic interface
"n lines"
7/26/2018 16:55:35.000 MULTITHREAD APP It goes to preserve the context of the destination window LAPEVEBIOMBIOM03C when setting the origin data DATA_ENTRY
"n lines"
7/26/2018 16:23:00.000 MULTITHREAD APP It goes to preserve the context of the destination window LARTVERT31RT3111C when setting the origin data DATA_ENTRY
"n lines"
7/26/2018 16:31:31.000 MULTITHREAD APP It goes to preserve the context of the destination window LAESVEES03ES0301C when setting the origin data DATA_ENTRY
"n lines"
我想以这种方式退出: 日期、Hour_Start、Hour_End、Windows_APP
例如:
7/26/2018,12:15:51.512,12:52:48.681,LARTVERT31RT3111C
7/26/2018,14:00:51.512,14:52:48.681,LAPEVEBIOMBIOM03C
7/26/2018,15:00:51.512,15:22:48.681,LAPEVEPE27PE2701C
7/26/2018,15:00:51.512,15:22:48.681,LARTVEIT29IT2901C
我停在这里,因为他们开始重复 LAPEVEPE27PE2701C、LAPEVEBIOMBIOM03C、LARTVERT31RT3111C 和 LAESVEES03ES0301C(从这里开始)
包含此数据的文件大约重 3.5Mb。而且有很多行
有人可以帮助我如何使用 awk 或类似工具(perl 或 bash)进行操作
【问题讨论】:
-
抱歉,这不是 StackOverflow 的工作方式。 “我想做 X,请给我提示和/或示例代码”形式的问题被认为是题外话。请访问help center并阅读How to Ask,尤其是阅读Why is “Can someone help me?” not an actual question?
-
grymoire.com/Unix/Awk.html 是学习 awk 和做文本处理的好地方..