$diff from_file to_file
The results of the command look like:
change-command
< from-file-line
< from-file-line...
---
> to-file-line
> to-file-line…
change-command means if you modify from_file according to this command you will get the same file as to_file.
$ diff /tmp/1.txt /tmp/2.txt
1d0: delete 1.txt line 1
< aaa: content in line 1 of 1.txt
3c2: change line 3 in 1.txt to line 2 in 2.txt
< ccc: content in line 3 of 1.txt
---
> c c: content in line 2 of 2.txt
7a7: add line 7 to 1.txt from line 7 in 2.txt
> hhh
Lines like "1d0" and "3c2" are the coordinates and types of the differences between the two compared files, while lines like "< aaa" and "> hhh" are the differences themselves.
Diff change notation includes 2 numbers and a character between them. Characters tell you what kind of change was discovered:
d – a line was deleted
c – a line was changed
a – a line was added
No comments:
Post a Comment