当前位置:首页 > 操作系统 > Linux

Linux中awk抽取包含某字段的整行日志

原文链接:https://blog.csdn.net/hgg923/article/details/51376295

命令示例:
awk '{if($0~"listAuths") print}' xxx.log
解释说明:抽取xxx.log整个日志文件中,包含“listAuths”的行,打印输出


抽取效果:
[root@SZB-L0005724 applogs]# awk '{if($0~"listAuths") print}' csp_iobs_core_trace.log.2016-04-27 
[INFO ] [2016-04-27 17:40:14] com.pingan.iobs.core.aspect.ControllerAspect -  listAuths finished! cost: 4ms. args : listAuths'args : 
[INFO ] [2016-04-27 17:41:13] com.pingan.iobs.core.aspect.ControllerAspect -  listAuths finished! cost: 5ms. args : listAuths'args : 
[INFO ] [2016-04-27 17:45:14] com.pingan.iobs.core.aspect.ControllerAspect -  listAuths finished! cost: 5ms. args : listAuths'args : 
[INFO ] [2016-04-27 17:50:15] com.pingan.iobs.core.aspect.ControllerAspect -  listAuths finished! cost: 5ms. args : listAuths'args : 
[INFO ] [2016-04-27 17:55:15] com.pingan.iobs.core.aspect.ControllerAspect -  listAuths finished! cost: 5ms. args : listAuths'args : 
[INFO ] [2016-04-27 18:00:16] com.pingan.iobs.core.aspect.ControllerAspect -  listAuths finished! cost: 5ms. args : listAuths'args : 
[INFO ] [2016-04-27 18:05:16] com.pingan.iobs.core.aspect.ControllerAspect -  listAuths finished! cost: 4ms. args : listAuths'args : 


详解:http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2858470.html
————————————————
版权声明:本文为CSDN博主「多来哈米」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/hgg923/article/details/51376295


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐