sed过滤字符串带有空格()

 #有时候在生产中需要对指定时间的日志进行收集,但是时间列是有空格的,我们可以通过以下方式进行过滤

[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.
————————

 #有时候在生产中需要对指定时间的日志进行收集,但是时间列是有空格的,我们可以通过以下方式进行过滤

[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.