Ignoring line breaks

Two- and three-way text compare and merge issues.

Ignoring line breaks

Postby hgolding » Tue Oct 31, 2006 11:31 pm

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.
User avatar
hgolding
Newbie
 
Posts: 1
Joined: Tue Oct 31, 2006 12:00 am

Re: Ignoring line breaks

Postby Mofi » Wed Nov 01, 2006 1:24 pm

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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Ignoring line breaks

Postby David.P » Mon Mar 19, 2012 9:33 am

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
David.P
Newbie
 
Posts: 1
Joined: Mon Mar 19, 2012 9:29 am

Re: Ignoring line breaks

Postby rhapdog » Mon Mar 19, 2012 5:17 pm

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.
User avatar
rhapdog
Master
Master
 
Posts: 253
Joined: Tue Apr 01, 2008 10:02 am
Location: Mississippi, USA

Re: Ignoring line breaks

Postby Mofi » Fri Apr 13, 2012 1:05 am

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.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 3937
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Text Compare and Merge