how to compare 2 very large textfiles
Pete
pete at mollysrevenge.com
Thu Oct 6 00:56:00 EDT 2011
Thanks Craig, I'll be interested to see how it works in real life (after he
gets rid of the duplicate "after" in the last repeat)!
Pete
Molly's Revenge <http://www.mollysrevenge.com>
On Wed, Oct 5, 2011 at 7:27 PM, <dunbarx at aol.com> wrote:
> Pete.
>
>
> Lovely and compact. If there is one thing that LC does that HC could only
> draem of, at least as regards raw processing power, it is arrays.
>
>
>
> Craig newman
>
>
> -----Original Message-----
> From: Pete <pete at mollysrevenge.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Wed, Oct 5, 2011 3:15 pm
> Subject: Re: how to compare 2 very large textfiles
>
>
> I've used an array to do this type of operation in the past. Haven't tried
> this code but it might work better.
>
> repeat for each line i in tTextA
> put true into myArray[i]["A"]
> end repeat
>
> repeat for each line i in tTextB
> put true into myArray[i]["B"]
> end repeat
>
> repeat for each line k in the keys of myArray
> if myArray[k]["A"] is not true then put k & return after after tMissingInA
> if myArray[k]["B"] is not true then put k & return after after tMissingInB
> end repeat
>
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
>
>
>
>
> On Wed, Oct 5, 2011 at 3:00 PM, Matthias Rebbe <
> matthias_livecode_150811 at m-r-d.de> wrote:
>
> > Hi,
> >
> > i need to compare two very large text files with about 5000 - 7000 lines
> > each with a lines size of up to 256 chars.
> >
> > I need to find out if there are lines missing in either file a or file b.
> >
> > What is the best way to do this with good speed?
> >
> > I tried to check each line in file a and if the line is in file b.
> > And after that, i check for each line in file b and try to find out
> > if the line is in file a.
> >
> > With large files it takes about 10 to 15 minutes to do the complete
> check.
> >
> > My script looks like this
> >
> > repeat for each line i in tTextA
> > if i is not among the lines of tTextB then put i &return after
> tMissingInB
> > end repeat
> >
> > repeat for each line i in tTextB
> > if i is not among the lines of tTextA then put i &retrurn after
> tMissingInA
> > end repeat
> >
> > Is there a better (faster) way?
> >
> > Regards,
> >
> > Matthias
> >
> >
> >
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> > subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> >
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
More information about the use-livecode
mailing list