newline-ignoring diff / diff across multiple lines / reflow-ignoring diff
        Posted  
        
            by Adam
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Adam
        
        
        
        Published on 2010-04-09T03:18:06Z
        Indexed on 
            2010/04/09
            3:23 UTC
        
        
        Read the original article
        Hit count: 823
        
diff
Does anybody know of a diff-like tool that can show me the changes between two text files, but ignore changes in whitespace including newlines?
Here's an example:
the quick brown fox jumped over the lazy bear. the quick brown fox jumped over the lazy bear. the quick brown fox jumped over the lazy bear. the quick brown fox jumped over the lazy bear.
quick brown fox jumped over the lazy bear. the quick brown fox jumped over the lazy bear. the quick brown fox jumped over the lazy bear. the quick brown fox jumped over the lazy bear.
All I did was delete one word and reflow it, but "diff -b" detects a change on every line (as it should; I'm not saying this is a bug in diff). But for large LaTeX files this is a major problem; change one word in a long paragraph and the diff you get back is basically useless.
By the way, I'm aware that this requires way more computational power than the usual lines-are-atomic diff. I'm only doing this on small human-generated files and am happy to wait a long time if I have to.
© Stack Overflow or respective owner