<p>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?</p>

[{'answer_id': 44028, 'author': 'Blair Conrad', 'author_id': 1199, 'author_profile': 'https://Stackoverflow.com/users/1199', 'pm_score': 5, 'selected': False, 'text': "<p>@EbGreen said</p>\n\n<blockquote>\n  <p>I would just take the log files and strip the timestamps off the start of each line then save the file out to different files. Then diff those files.</p>\n</blockquote>\n\n<p>That's probably the best bet, unless your diffing tool has special powers.\nFor example, you could</p>\n\n<pre><code>cut -b13- file1 &gt; trimmed_file1\ncut -b13- file2 &gt; trimmed_file2\ndiff trimmed_file1 trimmed_file2\n</code></pre>\n\n<p>See @toolkit's response for an optimization that makes this a one-liner and obviates the need for extra files. If your shell supports it. Bash 3.2.39 at least seems to...</p>\n"}, {'answer_id': 44033, 'author': 'toolkit', 'author_id': 3295, 'author_profile': 'https://Stackoverflow.com/users/3295', 'pm_score': 7, 'selected': True, 'text': '<p>Depending on the shell you are using, you can turn the approach <a href="https://stackoverflow.com/questions/44019/an-easy-way-to-diff-log-files-ignoring-the-time-stamps#44028">@Blair</a> suggested into a 1-liner</p>\n\n<pre><code>diff &lt;(cut -b13- file1) &lt;(cut -b13- file2)\n</code></pre>\n\n<p>(+1 to <a href="https://stackoverflow.com/questions/44019/an-easy-way-to-diff-log-files-ignoring-the-time-stamps#44028">@Blair</a> for the original suggestion :-)</p>\n'}, {'answer_id': 20129125, 'author': 'oHo', 'author_id': 938111, 'author_profile': 'https://Stackoverflow.com/users/938111', 'pm_score': 4, 'selected': False, 'text': '<p>Answers using <code>cut</code> are fine but sometimes keeping timestamps within the <code>diff</code> output is appreciable. As the OP\'s question is about <strong><em>ignoring the time stamps</em></strong> (not removing them), I share here my tricky command line:</p>\n\n<pre><code>diff -I \'^#\' &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 1.log) &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 2.log)\n</code></pre>\n\n<ul>\n<li><code>sed</code> isolates the timestamps (<code>#</code> before and <code>\\n</code> after) within a <a href="http://en.wikipedia.org/wiki/Process_substitution" rel="noreferrer">process substitution</a></li>\n<li><code>diff -I \'^#\'</code> ignores lines having these timestamps (lines beginning by <code>#</code>)</li>\n</ul>\n\n<hr>\n\n<h2>example</h2>\n\n<p>Two log files having same content but different timestamps:</p>\n\n<pre><code>$&gt; for ((i=1;i&lt;11;i++)) do echo "09:0${i::1}:00.000 data $i"; done &gt; 1.log\n$&gt; for ((i=1;i&lt;11;i++)) do echo "11:00:0${i::1}.000 data $i"; done &gt; 2.log\n</code></pre>\n\n<p>Basic <code>diff</code> command line says all lines are different:</p>\n\n<pre><code>$&gt; diff 1.log 2.log\n1,10c1,10\n&lt; 09:01:00.000 data 1\n&lt; 09:02:00.000 data 2\n&lt; 09:03:00.000 data 3\n&lt; 09:04:00.000 data 4\n&lt; 09:05:00.000 data 5\n&lt; 09:06:00.000 data 6\n&lt; 09:07:00.000 data 7\n&lt; 09:08:00.000 data 8\n&lt; 09:09:00.000 data 9\n&lt; 09:01:00.000 data 10\n---\n&gt; 11:00:01.000 data 1\n&gt; 11:00:02.000 data 2\n&gt; 11:00:03.000 data 3\n&gt; 11:00:04.000 data 4\n&gt; 11:00:05.000 data 5\n&gt; 11:00:06.000 data 6\n&gt; 11:00:07.000 data 7\n&gt; 11:00:08.000 data 8\n&gt; 11:00:09.000 data 9\n&gt; 11:00:01.000 data 10\n</code></pre>\n\n<p>Our tricky <code>diff -I \'^#\'</code> does not display any difference (timestamps ignored):</p>\n\n<pre><code>$&gt; diff -I \'^#\' &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 1.log) &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 2.log)\n$&gt;\n</code></pre>\n\n<p>Change <code>2.log</code> (replace <code>data</code> by <code>foo</code> on the 6th line) and check again:</p>\n\n<pre><code>$&gt; sed \'6s/data/foo/\' -i 2.log\n$&gt; diff -I \'^#\' &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 1.log) &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 2.log)\n11,13c11,13\n11,13c11,13\n&lt; #09:06:00.000\n&lt;  data 6\n&lt; #09:07:00.000\n---\n&gt; #11:00:06.000\n&gt;  foo 6\n&gt; #11:00:07.000\n</code></pre>\n\n<p><strong>=> timestamps are kept in the <code>diff</code>output!</strong></p>\n\n<p>You can also use the <em>side by side</em> feature using <code>-y</code> or <code>--side-by-side</code> option:</p>\n\n<pre><code>$&gt; diff -y -I \'^#\' &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 1.log) &lt;(sed -r \'s/^((.){12})/#\\1\\n/\' 2.log)\n#09:01:00.000                   #11:00:01.000\n data 1                          data 1\n#09:02:00.000                   #11:00:02.000\n data 2                          data 2\n#09:03:00.000                   #11:00:03.000\n data 3                          data 3\n#09:04:00.000                   #11:00:04.000\n data 4                          data 4\n#09:05:00.000                   #11:00:05.000\n data 5                          data 5\n#09:06:00.000                 | #11:00:06.000\n data 6                       |  foo 6\n#09:07:00.000                 | #11:00:07.000\n data 7                          data 7\n#09:08:00.000                   #11:00:08.000\n data 8                          data 8\n#09:09:00.000                   #11:00:09.000\n data 9                          data 9\n#09:01:00.000                   #11:00:01.000\n data 10                         data 10\n</code></pre>\n\n<hr>\n\n<h2>old <code>sed</code></h2>\n\n<p>If your <code>sed</code> implementation does not support the <code>-r</code> option, you may have to count the twelve dots <code>&lt;(sed \'s/^\\(............\\)/#\\1\\n/\' 1.log)</code> or use another pattern of your choice ;)</p>\n'}, {'answer_id': 30605051, 'author': 'Dave Andersen', 'author_id': 116311, 'author_profile': 'https://Stackoverflow.com/users/116311', 'pm_score': 4, 'selected': False, 'text': '<p>For a graphical option, <a href="http://meldmerge.org/" rel="noreferrer">Meld</a> can do this using its <a href="http://meldmerge.org/help/text-filters.html" rel="noreferrer">text filters</a> feature.</p>\n\n<p>It allows for ignoring lines based on one or more python regex. The differences still appear, but lines that don\'t have any other differences won\'t be highlighted.</p>\n\n<p><a href="https://i.stack.imgur.com/UcPjN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UcPjN.png" alt="Example configuration"></a></p>\n'}, {'answer_id': 33210487, 'author': 'Pedro Reis', 'author_id': 1665301, 'author_profile': 'https://Stackoverflow.com/users/1665301', 'pm_score': 2, 'selected': False, 'text': '<p>Use <strong>Kdiff3</strong> and at <strong>Configure>Diff</strong> edit "<strong>Line-Matching Preprocessor command</strong>" to something like:</p>\n\n<p><code>sed "s/[ 012][0-9]:[0-5][0-9]:[0-5][0-9]//"</code></p>\n\n<p>This will filter out time-stamps from comparison alignment algorithm.</p>\n\n<p>Kdiff3 also lets you <a href="https://stackoverflow.com/questions/9983314/manual-diff-alignment-in-kdiff3">manually align specific lines</a>.</p>\n'}, {'answer_id': 73319799, 'author': 'vlad2135', 'author_id': 6671, 'author_profile': 'https://Stackoverflow.com/users/6671', 'pm_score': 0, 'selected': False, 'text': '<p>I want to propose a solution for Visual Studio Code:</p>\n<ol>\n<li>Install this extension - <a href="https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff" rel="nofollow noreferrer">https://marketplace.visualstudio.com/items?itemName=ryu1kn.partial-diff</a></li>\n<li>Configure it like this - <a href="https://github.com/ryu1kn/vscode-partial-diff/issues/49#issuecomment-608299085" rel="nofollow noreferrer">https://github.com/ryu1kn/vscode-partial-diff/issues/49#issuecomment-608299085</a></li>\n<li>Run extension command &quot;Toggle Pre-Comparison Text Normalization Rules&quot; and enable rule added on step #2</li>\n<li>Use the extension (here is an explanation of it\'s UI quirk - <a href="https://github.com/ryu1kn/vscode-partial-diff/issues/11" rel="nofollow noreferrer">https://github.com/ryu1kn/vscode-partial-diff/issues/11</a>)</li>\n</ol>\n'}]
['https://Stackoverflow.com/questions/44019', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4061/']