cat poem1
twinkle twinkle
oompa loompa
cat poem2
twinkle twinkle
little star
how I wonder
what you are.
diff poem1 poem2
2c2,4
< oompa loompa
---
> little star
> how I wonder
> what you are.
If we use the recursive option -r, just like we do with rm or find etc, we can compare content of the sub dir as well.
diff -r dir1 dir2
Only in dir1/dir11: testfile11
diff -r dir1/testfile1 dir2/testfile1
1,2d0
< this is a line in dir1 file test1
< this is another line in dir1/test1
Only in d1: t2
Without option -r
diff dir1 dir2
Common subdirectories: dir1/dir11 and dir2/dir11
diff dir1/testfile1 dir2/testfile1
1,2d0
< this is a line in dir1 file test1
< this is another line in dir1/test1
Only in d1: t2
For intensive file comparisons sdiff is better as it lets side by side comparison.
sdiff poem1 poem2
twinkle twinkle twinkle twinkle
oompa loompa | little star
> how I wonder
> what you are.
No comments:
Post a Comment