How to ignore whitespace differences?

095

To ignore whitespace differences when using the diff command, you can use the -w option. This option tells diff to ignore all whitespace changes, including spaces and tabs.

Here’s how you can use it:

diff -w file1.txt file2.txt

If you are comparing directories and want to ignore whitespace differences, you can combine the -r option with -w:

diff -rw dir1/ dir2/

This will recursively compare the contents of dir1 and dir2, ignoring any differences in whitespace.

0 Comments

no data
Be the first to share your comment!