区分日志文件而不考虑时间戳的简单方法? [英] An easy way to diff log files, ignoring the time stamps?

查看:79
本文介绍了区分日志文件而不考虑时间戳的简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要比较两个日志文件,但忽略每行的时间戳部分(准确地说是前12个字符)。

I need to diff two log files but ignore the time stamp part of each line (the first 12 characters to be exact). Is there a good tool, or a clever awk command, that could help me out?

推荐答案

取决于正在使用的shell,是否有一个好的工具或聪明的awk命令可以帮助我? ,您可以采用 @Blair的方法推荐为1线形

Depending on the shell you are using, you can turn the approach @Blair suggested into a 1-liner

diff <(cut -b13- file1) <(cut -b13- file2)

(+ 1到 @ Blair 作为原始建议:-)

(+1 to @Blair for the original suggestion :-)

这篇关于区分日志文件而不考虑时间戳的简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆