[bugman@localhost 1]$ cat test1.txt
a a a a
[bugman@localhost 1]$ cat test2.txt
a
a
a
a
Now I'm trying to find difference, using -w (or --ignore-all-space) option:
[bugman@localhost 1]$ diff -w test1.txt test2.txt
1c1,4
< a a a a
---
> a
> a
> a
> a
But judging to MANs they should have no differences:
http://www.gnu.org/software/diffutils/manual/html_node/diff-Options.html#diff%20Options
-w --ignore-all-space Ignore white space when comparing lines. See White
Space<http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space>.
http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space
The -w and --ignore-all-space options are stronger still. They ignore
difference even if one line has white space where the other line has
none. White
space characters include tab, *newline*, vertical tab, form feed, carriage
return, and space; some locales may define additional characters to be white
space.
Is it a BUG? Or how can I get wishing result (ignore newlines while
comparing)?
> Here are two simple text files:
>
> [bugman@localhost 1]$ cat test1.txt
> a a a a
>
> [bugman@localhost 1]$ cat test2.txt
> a
> a
> a
> a
>
> Now I'm trying to find difference, using -w (or --ignore-all-space) option:
>
> [bugman@localhost 1]$ diff -w test1.txt test2.txt
> 1c1,4
> < a a a a
> ---
>> a
>> a
>> a
>> a
>
>
> But judging to MANs they should have no differences:
diff always operates on lines, which separated by newlines that are not
considered part of them.
> http://www.gnu.org/software/diffutils/manual/html_node/diff-Options.html#diff%20Options
> -w --ignore-all-space Ignore white space when comparing lines. See White
> Space<http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space>.
>
>
> http://www.gnu.org/software/diffutils/manual/html_node/White-Space.html#White%20Space
> The -w and --ignore-all-space options are stronger still. They ignore
> difference even if one line has white space where the other line has
> none. White
> space characters include tab, *newline*, vertical tab, form feed, carriage
> return, and space; some locales may define additional characters to be white
> space.
>
> Is it a BUG?
It's a documentation bug.
> Or how can I get wishing result (ignore newlines while comparing)?
Try wdiff.
Andreas.
--
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Thanks for the report.
FYI, that has been fixed for a while, and will
be updated with the next release, which will be soon.