#有时候在生产中需要对指定时间的日志进行收集,但是时间列是有空格的,我们可以通过以下方式进行过滤
[root@testdb-01 log]# cat messages|sed -n '/Nov 25 00:00:01/,/Nov 25 00:01:01/p' Nov 25 00:00:01 testdb-01 systemd: Created slice User Slice of root. Nov 25 00:00:01 testdb-01 systemd: Started Session 393 of user root. Nov 25 00:00:01 testdb-01 systemd: Removed slice User Slice of root. Nov 25 00:01:01 testdb-01 systemd: Created slice User Slice of root.
标签:25,00,01,空格,sed,testdb,字符串,Nov,root From: https://www.cnblogs.com/hanglinux/p/16923928.html