Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Location
    North Carolina
    Posts
    8

    Default How to ignore first so many characters in a text file?

    I am comparing two system logs. The first 14 characters in each line represent a timestamp which will always mismatch. I recall from using a Windows version of BC decades ago that I could ignore the first n characters in each line. Version 4 is so feature filled that I have not been able to figure out how to do the same thing. Can someone please provide me a clue as to how to do this?

    TIA,

    Ken

  2. #2
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    Hello,

    Yes, you can create a File Format for this file extension, and then define a Grammar Element for the first X characters (or a regular expression), and then mark this element as Unimportant. We have a KB article and video overview here:
    http://www.scootersoftware.com/suppo..._unimportantv3
    Aaron P Scooter Software

  3. #3
    Join Date
    Jul 2010
    Location
    North Carolina
    Posts
    8

    Default

    Thanks Aaron.

    However, this is Linux. File extensions are irrelevant. Files are associated by mime type. That said, I attempted to follow the instructions thusly.

    1 - Tools | File Formats. Make a new File Format - I did so and called it "joe"
    2 - Go to the Grammar tab. I then made a new Columns element called "junk" and defined it as columns 1 - 14
    3 - After saving I "open your pair of files in a Text Compare session."
    4 - Navigate to the Session | Session Settings | Importance tab. Checked Items are important.

    I see no items. How do I tell BC that I want these files to be considered format "joe"? I do not wish to apply the rule to ALL text files, just the two that I am working on.

    Never mind - I found that under Session Settings - Text Compare Format tab. I will leave my ramblings here as they might point someone else to this solution.

    Might I recommend that you add to your "Define Unimportant Text in Beyond Compare" article a note that if one defines a custom file format it may be necessary to select it in the session settings before the Important/Unimportant options become available.

    Thanks again,

    Ken

  4. #4
    Join Date
    Oct 2007
    Location
    Madison, WI
    Posts
    11,788

    Default

    Hello,

    The Importance tab is loading the current selected format's element list. If you have not loaded "joe", then it would be the detected format or the default Everything Else format.

    Detecting on MIME type is an extra tag that isn't supported universally across the various platforms and profile types that BC4 can run on or connect to. As files are transferred it could also be lost depending on if the transfer protocol or destination support setting it. This could cause comparisons to return false results due to a misdetection or the host OS or a user removing this information.

    When you open your new Text Compare with text files, if the extension matches then "joe" would be picked automatically. If not, you can use the File Format toolbar button's dropdown control to manually set the format, or use the Session Settings dialog to select the format.

    Once selected, that format is used for the current comparison and those element names will appear in the Importance tab.

    If the files do not have an extension, then you could use the Tools menu -> File Format dialog, and edit the white icon/Text Compare default Everything Else format.
    Aaron P Scooter Software

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •