Google Answers Logo
View Question
 
Q: Comparing large files under FreeBSD.. ( Answered,   0 Comments )
Question  
Subject: Comparing large files under FreeBSD..
Category: Computers > Programming
Asked by: chris21-ga
List Price: $10.00
Posted: 03 Jul 2002 13:50 PDT
Expires: 02 Aug 2002 13:50 PDT
Question ID: 36290
I need to compare two textfiles on FreeBSD.

The problem is: the files are 2 gig each. 

Diff gives me a "diff: memory exhausted". 

I have 20 gig of diskspace available for diff
and the machine has 256Meg's of memory.

Any ideas on what tool to use to compare these two files?
(and not having to wait 72 hours for the result or something :).

Any help is appreciated,
Chris
Answer  
Subject: Re: Comparing large files under FreeBSD..
Answered By: rishel-ga on 03 Jul 2002 14:50 PDT
 
Hi Chris21,

cmp will compare the two files and output lines it find that differ to
stdout.

# cmp  file1 file2

cmp is large file aware, and lucky for you can handle 2GB files. :)
Feel free to ask for clarification if you need any.


Related Links:

http://docsrv.caldera.com/SM_basics/saT.lfs.html


Search Criteria:

cmp large files

://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=cmp+large+files

Request for Answer Clarification by chris21-ga on 03 Jul 2002 15:03 PDT
Thanks for the quick reply:

The two files im comparing are two DNS zone files
from my two nameservers.

For example file1.txt contains
a
b
c
d

and file2.txt contains
a
b
c
e
f

cmp gives me this output:
#cmp file1.txt file2.txt
file1.txt file2.txt differ: char 14, line 1

However, diff tells me d is missing compared to file 1 and e/f are added.
This is the output im looking for.. can cmp do that?

Clarification of Answer by rishel-ga on 03 Jul 2002 17:41 PDT
If the number of changes are small, the patch could be made from that
what cmp returns, but I have the feeling that answer won't work for
you.  If you are only going to be making insertions, and no deletions,
the program xdelta would work well.  xdelta is available under the
ports system in misc.

 ( http://www.freebsd.org/cgi/url.cgi?ports/misc/xdelta/pkg-descr )

Another option I would try is lfcompile utility.  It will change
source so it compiles with large file support.  I gave it a shot with
the diff source on my linux box, and it worked, but I didn't have any
2GB files to play with, so I don't know how performance is or if the
out of memory problems go away.  I'd give that a shot.

Feel free to ask for more clarification, and thank you for using
Google Answers!
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy