awk sed示例

来源:互联网 发布:上海可靠性软件通 编辑:程序博客网 时间:2024/06/07 02:25

查询某个时间段的日志:

sed '/10:27:07.010/,/16:28:08.403/!d;/cost/!d'  cif.log

注意:这两个时间段日志中必须存在,可用grep查询


查询09:00~09:01,调用接口耗时大于100ms的接口

awk -F"cost:" '{if ($2>100&&!match($0,"getCust")&&match($0,"09:00")) {split(substr($0,index($0,"call method"),40),a,","); print substr($0,0,12), a[1],"cost:",$2}}' cif.log


原创粉丝点击