Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Diff command not working logically

Tags:

linux

diff

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?

like image 313
mhm Avatar asked Apr 20 '26 05:04

mhm


1 Answers

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.

like image 96
Prakhar Agarwal Avatar answered Apr 21 '26 17:04

Prakhar Agarwal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!