我是靠谱客的博主 仁爱黄蜂,这篇文章主要介绍linux 正则匹配搜索优化,现在分享给大家,希望可以做个参考。

比如我想搜索下面内容

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'

最后

以上就是仁爱黄蜂最近收集整理的关于linux 正则匹配搜索优化的全部内容,更多相关linux内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(136)

评论列表共有 0 条评论

立即
投稿
返回
顶部