[文本处理] 将查询到相邻两行合并为一行
oracle RedoLog文件名 dbname_lgwr_25049.trc
文件格式如下:
*** SESSION ID3289.1) 2018-02-18 17:31:03.615
Maximum redo generation record size = 154624 bytes
Maximum redo generation change vector size = 150680 bytes
*** 2018-02-18 21:30:02.349
Warning: log write time 770ms, size 2KB
*** 2018-02-19 18:35:03.075
Warning: log write time 1000ms, size 7KB
*** 2018-02-20 02:10:01.678
Warning: log write time 560ms, size 2KB
*** 2018-02-20 02:10:02.677
目标:
将带有时间行和“Warning: log write time 770ms, size 2KB”行输出到一行,直观展示,便于统计。
实现:
cat dbname_lgwr_25049.trc |awk '/201/{t=$0}/write/{print t,$0}'
文件格式如下:
*** SESSION ID3289.1) 2018-02-18 17:31:03.615
Maximum redo generation record size = 154624 bytes
Maximum redo generation change vector size = 150680 bytes
*** 2018-02-18 21:30:02.349
Warning: log write time 770ms, size 2KB
*** 2018-02-19 18:35:03.075
Warning: log write time 1000ms, size 7KB
*** 2018-02-20 02:10:01.678
Warning: log write time 560ms, size 2KB
*** 2018-02-20 02:10:02.677
目标:
将带有时间行和“Warning: log write time 770ms, size 2KB”行输出到一行,直观展示,便于统计。
实现:
cat dbname_lgwr_25049.trc |awk '/201/{t=$0}/write/{print t,$0}'