문제

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?

도움이 되었습니까?

해결책 2

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

다른 팁

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.

Look at them in Hex format. This way you can really see if they are the same.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top