I am comparing two text files and I get the following result:
diff file1 file2 | grep 12345678
> 12345678
< 12345678
As you can see, the same string exists in both files, and both files were sorted with sort
.
The line endings must be getting in the way here (Windows vs. Unix).
Is there a way to get diff
to ignore line endings on Unix?
diff --strip-trailing-cr file1 file2
? – Miranda-w
? – Pyrone-w
ignores differences in white spaces, and"White space" characters include tab, vertical tab, form feed, carriage return, and space
. For instance,diff a b
will show difference for ` line` and<tab>line
, butdiff -w a b
won't – Mirandadiff
are the best solution. – Pyrone