一种区分日志文件的简单方法,忽略时间戳? [英] An easy way to diff log files, ignoring the time stamps?

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

问题描述

我需要区分两个日志文件,但忽略每行的时间戳部分(准确地说是前 12 个字符).有什么好的工具,或者聪明的 awk 命令可以帮助我吗?

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,可以转方法@Blair 建议使用 1-liner

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天全站免登陆