比如我想搜索下面内容
09:00:02.870 [pool-5-thread-5] INFO c.z.front.timer.SendRemindMsgTasks - 待发送消息:{"appId":"wx57cb96bc41d6fc2b","msgType":41,"touser":"o3xYd5BLr2JAPjNX86Eqj04WSihE","userId":1806}
09:00:03.045 [pool-5-thread-5] INFO c.z.front.timer.SendRemindMsgTasks - 待发送消息:{"appId":"wx57cb96bc41d6fc2b","msgType":41,"touser":"o3xYd5AZYqHRCWB0pUtrZ1wuLeuQ","userId":1822}
原先这样,是全匹配会慢
grep -E '待发送消息(.*)appId(.*)wx57cb96bc41d6fc2b(.*)msgType(.*)41' openapi.2021-09-01.0.log
改成这样会快很多
grep -E '待发送消息' openapi.2021-09-01.0.log | grep appId | grep wx57cb96bc41d6fc2b | grep -E 'msgType(.*)41'