Diff -b and -w difference

Posted by dotancohen on Super User See other posts from Super User or by dotancohen
Published on 2013-06-29T14:15:20Z Indexed on 2013/06/29 16:24 UTC
Read the original article Hit count: 239

Filed under:
|
|

From the diff manpage:

-b, --ignore-space-change
      ignore changes in the amount of white space

-w, --ignore-all-space
      ignore all white space

From this, I infer that the difference between the -b and -w options must be that -b is sensitive to the type of whitespace (tabs vs. spaces). However, that does not seem to be the case:

$ diff 1.txt 2.txt 
1,3c1,3
<     Four spaces, changed to one tab
<         Eight Spaces, changed to two tabs
<     Four spaces, changed to two spaces
---
>       Four spaces, changed to one tab
>               Eight Spaces, changed to two tabs
>   Four spaces, changed to two spaces
$ diff -b 1.txt 2.txt 
$ diff -w 1.txt 2.txt 
$

So, what is the difference between the -b and -w options? Tested with diffutils 3.2 on Kubuntu Linux 13.04.

© Super User or respective owner

Related posts about linux

Related posts about command-line