Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-27-2004, 12:07 PM   #1
LQ Newbie
Registered: Jan 2004
Location: Massachusetts, USA
Distribution: Mepis
Posts: 18

Rep: Reputation: 0
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 ?
Old 01-27-2004, 12:10 PM   #2
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
diff or various gui's like xxdiff.
Old 01-27-2004, 02:41 PM   #3
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
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

Old 01-27-2004, 06:39 PM   #4
Senior Member
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script to compare dir contents Boffy Programming 2 08-02-2005 06:08 AM
How do I compare 2 files? linuxhippy Slackware 6 03-26-2005 01:54 AM
How to compare two folders contents? rvoigt Linux - Newbie 6 01-07-2005 12:35 AM
Diff compare 2 files DavidTempler Linux - Newbie 2 11-01-2004 10:00 AM
Compare two cvs files.... trey85stang Linux - General 3 10-23-2004 08:05 PM

All times are GMT -5. The time now is 10:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration