系统相关
首页 > 系统相关> > Linux中awk抽取包含某字段的整行日志

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

标签:core,27,某字,04,com,args,整行,awk,listAuths
来源: https://blog.csdn.net/Gavid0124/article/details/100920331