1st line: a stands for added, d for deleted and c for changed. Line numbers of the original file appear before these letters and those of the modified file appear after the letter.
2nd line: line with < are from file 1 and are different from file 2.
3rd line is a divider.
4th line: line with > are from file 2 and are different from file 1.
(If you ever see = it means the lines are the same in both files)
And your problem might be whitespaces or other non-human readable characters: those trigger a difference too.
There are some options to manipulate output.
Example:
rinzwind@discworld:~$ more 1
test
test2
test3
rinzwind@discworld:~$ more 2
test
test2
test3
A "!" represents a change between lines that correspond in the two files. A "+" represents the addition of a line, while a blank space represents an unchanged line. At the beginning of the patch is the file information, including the full path and a time stamp. At the beginning of each hunk are the line numbers that apply for the corresponding change in the files. A number range appearing between sets of three asterisks applies to the original file, while sets of three dashes apply to the new file. The hunk ranges specify the starting and ending line numbers in the respective file.
Expanding on Lekensteyn's comment about unified format:
The format starts with the same two-line header as the context format, except that the original file is preceded by "---" and the new file is preceded by "+++". Following this are one or more change hunks that contain the line differences in the file. The unchanged, contextual lines are preceded by a space character, addition lines are preceded by a plus sign, and deletion lines are preceded by a minus sign.
I find od (octal dump) to be handy when comparing files w/ non-printable characters (particularly files which diff decides are "binary" and thus tells you only that they do differ).
In the example below, I create a pair of files that could be like the original ones, then do a diff with the original output; next I do diff on a couple of different "od" outputs.
$ echo 1 > 1
$ echo "1 " > 2
$ diff 1 2
1c1
< 1
- ---
> 1
$ od -c 1 > 1.od
$ od -c 2 > 2.od
$ diff 1.od 2.od
It's very likely that a non-printing character is lurking around in one of the lines. Just pipe the output into cat -t to display any non-printing characters:
1st line:
a
stands for added,d
for deleted andc
for changed. Line numbers of the original file appear before these letters and those of the modified file appear after the letter.2nd line: line with
<
are from file 1 and are different from file 2.3rd line is a divider.
4th line: line with
>
are from file 2 and are different from file 1.(If you ever see
=
it means the lines are the same in both files)And your problem might be whitespaces or other non-human readable characters: those trigger a difference too.
There are some options to manipulate output.
Example:
contexted format:
A "!" represents a change between lines that correspond in the two files. A "+" represents the addition of a line, while a blank space represents an unchanged line. At the beginning of the patch is the file information, including the full path and a time stamp. At the beginning of each hunk are the line numbers that apply for the corresponding change in the files. A number range appearing between sets of three asterisks applies to the original file, while sets of three dashes apply to the new file. The hunk ranges specify the starting and ending line numbers in the respective file.
Expanding on Lekensteyn's comment about unified format:
The format starts with the same two-line header as the context format, except that the original file is preceded by "---" and the new file is preceded by "+++". Following this are one or more change hunks that contain the line differences in the file. The unchanged, contextual lines are preceded by a space character, addition lines are preceded by a plus sign, and deletion lines are preceded by a minus sign.
Some useful options:
-b
Ignore changes in the amount of white space.-w
Ignore all white space.-B
Ignore all blank lines.-y
output in 2 colums.I find od (octal dump) to be handy when comparing files w/ non-printable characters (particularly files which diff decides are "binary" and thus tells you only that they do differ).
In the example below, I create a pair of files that could be like the original ones, then do a diff with the original output; next I do diff on a couple of different "od" outputs.
$ echo 1 > 1
$ echo "1 " > 2
$ diff 1 2
$ od -c 1 > 1.od
$ od -c 2 > 2.od
$ diff 1.od 2.od
$ od -Ax -c -t x1 1 > 1.od
$ od -Ax -c -t x1 2 > 2.od
$ diff 1.od 2.od
i had the same problem and i found a solution that might help, use the command :
one of them might be in a dos/windows format and the other one UNIX format
after i did this the diff was all good!
Not sure if this helps with hard to find whitespace characters, but it's handy for diffing: http://www.gnu.org/software/wdiff/
http://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html#Detailed-Unified
Above link provides more concise and clear description.
It's very likely that a non-printing character is lurking around in one of the lines. Just pipe the output into
cat -t
to display any non-printing characters: