LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   to compare the contents of 2 files (https://www.linuxquestions.org/questions/linux-newbie-8/to-compare-the-contents-of-2-files-139251/)

MaleWithBrains 01-27-2004 12:07 PM

to compare the contents of 2 files
 
say I have 2 files that almost look like each other and I am too lazy to scroll down and compare each one by one

is there a way to compare the contents of the 2 and put the differences into a txt file / screen display etc ?

slakmagik 01-27-2004 12:10 PM

diff or various gui's like xxdiff.

twantrd 01-27-2004 02:41 PM

Digiot is right. Use diff.

diff <file 1> <file 2>

if you want to output the differences into a file and look at them then:

diff (file 1) (file 2) > difference.txt

-twantrd

SciYro 01-27-2004 06:39 PM

cmp can also work, it just givs a bunch of numbers tho, soo u cant use its output to patch files

cmp --help for info otherwise its just like

cmp file1 file2


All times are GMT -5. The time now is 06:41 PM.