Reputation: 313
Original file contains:
B
RBWBW
RWRWWRBWWWBRBWRWWBWWB
My file contains :
B
RBWBW
RWRWWRBWWWBRBWRWWBWWB
However when i use the command diff original myfile
it shows following:
1,3c1,3
< B
< RBWBW
< RWRWWRBWWWBRBWRWWBWWB
---
> B
> RBWBW
> RWRWWRBWWWBRBWRWWBWWB
When i put -w tag (diff original myfile -w
) it shows no differences... but I'm absolutely sure these two files do not have whitespace/endline differences. What's the problem?
Upvotes: 3
Views: 9557
Reputation: 2842
These texts are equal.
Maybe you have extra white spaces.
try
diff -w -B file1.txt file2.txt
-w Ignore all white space.
-B Ignore changes whose lines are all blank.
Upvotes: 7
Reputation: 289725
As seen in the comments, you must have some different line endings, caused because of an original file coming from a DOS system. That's why using -w
dropped the end of the line and files matched.
To repair the file, execute:
dos2unix file
Upvotes: 2
Reputation: 24464
Look at them in Hex format. This way you can really see if they are the same.
Upvotes: 1