Results 1 to 10 of 11
Hi Friends, i often compare two different files which differ slightly in there contents can you suggest me any tool or utility which will make my task easier.
At present ...
- 06-18-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 12
Comapre two different files easily
Hi Friends, i often compare two different files which differ slightly in there contents can you suggest me any tool or utility which will make my task easier.
At present i am using diff, sdiff command to compare the files any better option than this ?
- 06-18-2010 #2
What´s wrong with diff? Perfect for the job

But if you look for a graphical tool, try Meld : ScreenshotsYou must always face the curtain with a bow.
- 06-18-2010 #3Just Joined!
- Join Date
- Apr 2010
- Posts
- 12
diff command's output is difficult to grasp quickly so want some other option to compare files
- 06-18-2010 #4Just Joined!
- Join Date
- Mar 2006
- Location
- Manila, Philippines
- Posts
- 3
RE: Comapre two different files easily
Aside from diff and sdiff you can use cmp command which compares two files and tells you which line numbers are different. Others use perl script to compare the 2 files which allows them to manipulate the output of comparisson between the two files.
- 06-21-2010 #5Just Joined!
- Join Date
- Apr 2010
- Posts
- 12
- 06-21-2010 #6
I would still recommend diff.
It is the standard tool for exactly that task and definitely worth learning.You must always face the curtain with a bow.
- 06-21-2010 #7Just Joined!
- Join Date
- Apr 2010
- Posts
- 12
- 06-21-2010 #8Just Joined!
- Join Date
- Jun 2010
- Location
- silicon valley
- Posts
- 6
Hi,
When I want to use diff for files that have only minor differences, and also read the output easily, I do the following command:
diff -y file1 file2 > output.txt
This compares the two files side by side and puts the output into a file called output.txt (put whatever name you want there). You don't have to write to an output file but it makes it easier to read, especially for long files. For example I did the following command:
diff -y e820.c e820.orig.c > e820diff.txt
Within my e820diff.txt file, lines that are similar but different look like this:
&e820.map[i+offset], | &e820.map[i+1]
(the vertical bar shows the lines are similar but contain a change)
Lines that are in one file but not the other will have a < or > to indicate the line is only in the first or second file, respectively; for example this line:
i++; <
was only in the first file I listed.
Hope that helps! Once you get the hang of using diff, you'll never go back (:
- 06-22-2010 #9Just Joined!
- Join Date
- Apr 2010
- Posts
- 12
- 06-22-2010 #10Just Joined!
- Join Date
- Jun 2010
- Location
- silicon valley
- Posts
- 6
Awesome!!!
When you have some spare time, make a set of test files that have minor to huge differences; play around with the diff options (read the manual page - man diff) and see what sorts of things you can get it to do. I like seeing the whole file side-by-side; other people prefer to see just the changes, or other options. It's a very powerful tool!


Reply With Quote
