Visit sourceforge and look for winmerge, a really excellent software that does just what you want.
Thrust me - install this software and never look for anything else, :) Altleast if your on a windows environment. -- -- Kim Steinhaug ---------------------------------------------------------------------- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. ---------------------------------------------------------------------- www.steinhaug.com - www.easywebshop.no - www.webkitpro.com ---------------------------------------------------------------------- "Jens Schmeiser" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dear list. > > I want to compare two text files and print the differences. The text files > contain the structure of a database, so they are very big (>6000 lines). > The file looks like that: > > TABLENAME#COLUMNNAME#DATATYPE#DATALENGTH#DATAPRECISION#NULLS > ... > > I only check if the datatype and nulls are different. If so, then the two > lines of the files will be printed. > > I tried to do that and it works excellent if there aren't many differences, > but if there are many diffs, it takes time and time. > > What I do now is to read the to files to an array and get the differences > with array_diff > > $array1=file('file1.txt'); > $array2=file('file2.txt'); > > $result1 = array_diff($array1,$array2); > $result2 = array_diff($array2,$array1); > > After that I do the following: > foreach ($result1 as $line1) { > foreach ($result2 as $line2) { > // compare the two lines and show the differences; > continue; > } > } > > Is there a better way to do that (and of course faster)? > > > Regards > Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php