Home > OS >  The grep output filter specified on a line and a line
The grep output filter specified on a line and a line

Time:10-27

Excuse me, great god, such as the following log information:
The 2020-10-24 01:55:28. 415:
Aaaaaaaaaa
The 2020-10-25 01:55:28. 415:
BBBBBBBBBB
The 2020-10-26 01:55:28. 415:
CCCCCCCCCC
The 2020-10-26 01:55:28. 415:
[CTSSD (6797)] CRS - 2408: The clock on The host
The 2020-10-26 02:26:24. 702:
[CTSSD (6797)] CRS - 2408: The clock on The host
The 2020-10-26 02:59:20. 981:
[CTSSD (6797)] CRS - 2408: The clock on The host
The 2020-10-26 03:32:33. 281:
[CTSSD (6797)] CRS - 2408: The clock on The host
The 2020-10-26 04:05:53. 588:
[CTSSD (6797)] CRS - 2408: The clock on The host
The 2020-10-26 04:39:13. 904:
[CTSSD (6797)] CRS - 2408: The clock on The host

View the log file, the line will contain "CRS - 2408" as well as the top row date filter, only:
The 2020-10-24 01:55:28. 415:
Aaaaaaaaaa
The 2020-10-25 01:55:28. 415:
BBBBBBBBBB
The 2020-10-26 01:55:28. 415:
CCCCCCCCCC

How to implement

CodePudding user response:

Sed 'N./\ n * CRS */! P; D 'logfile | grep -v CRS
  • Related