1821583 Members
3357 Online
109633 Solutions
New Discussion юеВ

diff

 
SOLVED
Go to solution
Sheng Jin
Occasional Contributor

diff

I need to do a line by line comparison on two very large files (2 MG), which are similar files. The "diff" command will give a message as "file too long, try -h". I tried -h option but it is not exactly what I want. Any other command will do the job.
Like rowing upstream, not to advance is to drop back
4 REPLIES 4
CHRIS_ANORUO
Honored Contributor
Solution

Re: diff

Use bdiff- this is for large files.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
CHRIS_ANORUO
Honored Contributor

Re: diff

Use bdiff - this is for large files.
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
federico_3
Honored Contributor

Re: diff

you can try the comm command ( see man comm) :

comm -12 file1 file2 -> prints only the lines common to the 2 files

comm -23 file1 file2 -> prints only the lines in the first not in the second



Federico

James R. Ferguson
Acclaimed Contributor

Re: diff

Hi:

The -h option of 'diff' is for "half-hearted" comparisons. For really big files, use 'bdiff'. You could also try 'cmp' or 'comm'. See the man pages for all of these.

...JRF...