Ignoring line breaks

Ignoring line breaks

1
NewbieNewbie
1

    Nov 01, 2006#1

    Is it possible to tell UC to ignore line breaks when comparing files?

    For example if file 1 contains:
    ...
    abc def ghi
    ...
    and file 2 contains:
    ...
    abc
    def ghi
    ...
    then ignore this difference.

    This would be useful when comparing a reformated version of some source code with the same file before reformatting.

    6,680583
    Grand MasterGrand Master
    6,680583

      Nov 01, 2006#2

      No, that's not possible. UltraCompare (Lite) in text mode use a line by line compare (as all other compare tools I know too). So the line breaks cannot be ignored.

      The option Ignore Line Terminators is only to allow the active compare to ignore line terminator differences (DOS/UNIX/MAC) when comparing files for differences.
      Best regards from an UC/UE/UES for Windows user from Austria

      1
      NewbieNewbie
      1

        Mar 19, 2012#3

        Mofi wrote:UltraCompare (Lite) in text mode use a line by line compare (as all other compare tools I know too). So the line breaks cannot be ignored.
        Hi forum,

        is the above still valid? I mean, still no compare tools around that DON'T report the following two chunks as "different":

        Code: Select all

        left:
        <div id="footer-int-2">© 2009 - 2010 ACME - all
        rights reserved</div>
        
        right:
        <div id="footer-int-2">© 2009 - 2010 ACME - all rights reserved</div>
        
        Come on, that simply CAN'T be true!

        Thanks heaps already for help
        David.P

        2362
        MasterMaster
        2362

          Mar 19, 2012#4

          I do see where this would come in handy, especially since there are times that I would like to compare 2 files that have been submitted to me for review, where one is a "minified" version, for example a JavaScript or CSS file, and the other is supposedly (but not always, as sometimes there is an error in one and not the other) the same thing but not minified. A comparison like that would certainly make tracing issues easier, although I wouldn't expect it to be in the "lite" version of UltraCompare.

          It is not, however, at this time supported by UltraCompare Lite or Professional, nor any other product that I am aware of.

          Since "white space" (tabs and spaces) can be ignored completely and discarded, it is "technically" true that line terminators could be "discarded" while comparing, however, since the compare utilities have to show you the "line by line" differences, it would be impossible to visually show you where the differences are in the files. The utility would be limited to stating "files match" or "files do not match." Not very helpful. I suppose someone could come up with a way to visually "compare" the two uneven lined files, however, it would not be easily understood by the average user, and, quite possibly impossible to understand for most. It would, at the very least, be a very ugly representation.

          What you really need is a code formatter to reformat the code in a more readable format before you do the compare. Running HTML Tidy on an HTML document will fix those lines up to be the same before you run the compare. Try it and see.

          6,680583
          Grand MasterGrand Master
          6,680583

            Apr 13, 2012#5

            It is quite easy with UltraEdit or UEStudio to reformat text before running a text compare if there are differences caused by line breaks. Open copies of both files in UE / UES and run following macro:

            InsertMode
            ColumnModeOff
            Top
            TrimTrailingSpaces
            ReturnToWrap

            WrapToReturn 80

            That removes all line breaks within paragraphs. The last command inserts hard returns (line breaks) at column 80 or before depending on the text. Now (after saving the two files) it is easy to compare the text files because differences caused by line breaks on different positions in text are eliminated.