For work reasons, to view the system log frequently, you can view the logs for a specified period of time with the following command:
#sed '/oct 06:*/,/08:*/!d '/var/log/syslog
This section shows all logs for the syslog October 26 morning at 6-8, and prints them out.
! D means: Delete all rows that are not selected and only keep all logs with a condition of 6-8 points in the morning, such as:
650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/26/f23c2656b6b7dce6e9e03f11159f98c3.png-wh_500x0-wm_3 -wmp_4-s_228778846.png "title=" Qq20171026095149.png "alt=" F23c2656b6b7dce6e9e03f11159f98c3.png-wh_ "/>
SED command:
! Indicates that the subsequent command has effect on all rows that are not selected.
d Delete, delete the selected row.
This article is from the Linux OPS blog, so be sure to keep this source http://kfensa.blog.51cto.com/7057855/1976278
Use SED to view logs for a specified time period of Linux