No announcement yet.

Ignore first X characters of line during text comparison

  • Filter
  • Time
  • Show
Clear All
new posts

  • Ignore first X characters of line during text comparison

    First, I accidentally posted this in the bc3 forum, so the text below is identical. If a moderator could please remove that post, that would be great, since I can't seem to delete it or edit it.

    I have two files that use the same logging format, but the timestamps obviously differ. Right now I'm able to essentially purge the first 31 characters of the line and write the outputs to new files with PowerShell like so:

    ( Get-Content file1.txt ) -replace '^.{31}' | Set-Content -enc utf8 file1-notimestamp.txt
    And then do the same thing for the second file. But I'd like to know how to ignore the first 31 (or any number) of characters in both files during a text compare. I found another forum post here saying to mark View > Ignore Unimportant Differences but this doesn't seem to have any effect as the timestamps are still showing up as differences.

  • #2

    The guide you are looking for is here:

    You'll define a new File Format for your file extension, and within that format, define an element to match your concept (first 31 or X characters), give that element a Name, and then you can mark that element as Important or Unimportant in the Text Compare's Session Settings.

    The Ignore Unimportant Differences allows you to toggle Unimportant Blue differences (still differences), to treat them as if they are equal (black) when it is toggled On.
    Aaron P Scooter Software