Skip to content

Latest commit

 

History

History
84 lines (62 loc) · 1.03 KB

diff.md

File metadata and controls

84 lines (62 loc) · 1.03 KB

diff

difference

compare files line by line


References

  • man diff

Quickstart

diff -y file1 file2 # Output in two columns
# -y == --side-by-side

# e.g. output
1   <
2     2
3     3
    > 4
# < : lines from file1
# > : lines from file2

Options

  • -y, --side-by-side output in two columns
  • -i, --ignore-case ignore case differences in file contents
  • -E, --ignore-tab-expansion ignore changes due to tab expansion
  • -Z, --ignore-trailing-space ignore white space at line end
  • -b, --ignore-space-change ignore changes in the amount of white space
  • -w, --ignore-all-space ignore all white space
  • -B, --ignore-blank-lines ignore changes where lines are all blank
  • ……

Usage

Sample

$ cat file1
1
2
3

$ cat file2
2
3
4

Default

$ diff file1 file2
1d0
< 1
3a3
> 4

Side by Side

  • %< lines from FILE1
  • %> lines from FILE2
$ diff -y file1 file2
1      <
2        2
3        3
       > 4

See Also

vimdiff

$ vimdiff file1 file2