From: Robert Klemme Date: 2005-12-09T03:47:37+09:00 Subject: Re: New guy... Intoduction and first question on some direction. Oscar Gonzalez wrote: > Hi everyone. I'm new to these forums. I am sysadmin in California and > I'm learning Ruby. I've been working on an automated web application > testing using WATIR and I really like this language. Its the first one > I've actually contiuned learning after the "hello world" example. That's great news! Welcom aboard. > It even made me want to write something on my own outside of work and > here's the basics of the project... I just don't even know where to > start. I can't seem to be searching for the right terms thus I can't > find modules that would help me out. > > -- sorry for the lenght of the post -- > > I want to merge 2 data txt files together. > - Each file has sections and subsections. > - Each section and subsection has data that may or may not be on both > files. > - The data that is in both files may be slightly different and in this > case I need it to be "magically merged together" if its within certain > arbitrary range > - The data that is in both files that is outside of the range I > mention above needs to be considered "new" data for the resulting > file... - I'm not good with reg expressions but I can learn if that > is part of the solution. > > > I was going to post 2 samples of the files I want to merge but the > post would have been over 4 pages long! Do you guys think the "needs" > I've posted are enough to point me in the right direction? It's difficult to help out with some hints as we don't know much yet. Probably just post as much from those files so we can recognize how sections and subsections are recognized. From what I know so far: you might want to have classes Section and SubSection with obvious meaning. I don't know whether there's some kind of optimization possible with your data but in the worst case you'll have O(n*m) effor to compare all possible pairs of SubSections. Also the algorithm to decide whether they are close or not might be tricky. Kind regards robert