Operating System - HP-UX
1833461 Members
3187 Online
110052 Solutions
New Discussion

Re: command or script to compare 2 long text file ..

 
SOLVED
Go to solution
someone_4
Honored Contributor

command or script to compare 2 long text file ..

I have 2 files - httpd.conf and httpd.conf.bk is there a command or script that I can run that can tell me what line or setting is diffent in 2 diffent long files and put the out put to another .txt file ?

thanks

Richard
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: command or script to compare 2 long text file ..

You bet Richard,

try diff httpd.conf httpd.conf.bk > /tmp/diffs

This will output the differences to the tmp file. There are several variants of the diff command - man diff for the details.

Clay
If it ain't broke, I can fix that.
federico_3
Honored Contributor

Re: command or script to compare 2 long text file ..


Use bdiff (diff for largefiles)


Federico
Philip Chan_1
Respected Contributor

Re: command or script to compare 2 long text file ..


Just run,

diff httpd.conf httpd.conf.bk >httpd_diff.txt

All the differences will be stored into the output file. Do "man diff" for detail description with "diff".

~Philip
Vincenzo Restuccia
Honored Contributor

Re: command or script to compare 2 long text file ..

sdiff httpd.conf httpd.conf.bk >httpd_diff.txt, see man sdiff

f. halili
Trusted Contributor

Re: command or script to compare 2 long text file ..

You may use diff:

Ex.
$ diff file file.bk > dif.txt

- fnhalili
derekh