[TAG] 2 Cent Tip: Tell diff to ignore whitespaces

Benjamin A. Okopnik ben at linuxgazette.net
Sun Nov 13 19:22:52 MSK 2005


On Thu, Nov 10, 2005 at 05:27:39PM -0500, Suramya Tomar wrote:
> Remembered this while reading the emails going back and forth between 
> Peter and Ben about diff'ing files.
> 
> To tell diff to ignore white spaces and do a case-insensitive comparison 
> use the following command:
> 
> diff -ibw FirstFile SecondFile
> 
> Where
> 
>  -b    Ignores trailing blanks (spaces and tabs) and treats
>        other strings of blanks as equivalent.
> 
>  -i    Ignores the case of letters
> 
>  -w    Ignores all blanks  (SPACE  and  TAB  characters)  and
>        treats  all other strings of blanks as equivalent; for
>        example,  `if ( a == b )'  will   compare   equal   to
>        `if(a==b)'.
> 
> Hope this helps.

I used to use 'mgdiff', but these days I just do 'vim -d file1 file2'.
However, the above _is_ nicely useful - thanks, Suramya!


* Ben Okopnik * Editor-in-Chief, Linux Gazette * http://linuxgazette.net *





More information about the TAG mailing list