On Thursday 08 December 2005 02:13 pm, Oscar Gonzalez wrote: > akonsu wrote: > > hello, > > > > 1. what should happen if the files have different structure (different > > set of sections/subsections)? > > > > 2. please define "data", "magically merged together", "range". > > Thanks for the responses guys... Here's a little more info based on > them. > > The sections and subsections and data are defined by {} and [] and > values... for example. > > DataGroup = { > [1] = { > [1] = { > ["dataidentifier"] = { > [1] = { > ["type"] = 1, > ["x"] = 45.5, > ["count"] = 1, > ["image"] = 4, > ["y"] = 18.8, > }, > [1] = { > ["type"] = 1, > ["x"] = 21.5, > ["count"] = 5, > ["image"] = 4, > ["y"] = 31.8, > }, > }, > [2] = { > ["dataidentifier2"] = { > [1] = { > ["type"] = 1, > ["x"] = 74.5, > ["count"] = 1, > ["image"] = 3, > ["y"] = 11.8, > }, > [1] = { > ["type"] = 1, > ["x"] = 27.5, > ["count"] = 5, > ["image"] = 3, > ["y"] = 36.8, > }, > }, If you can count on indentation like you have above, the easy way might be to run it through the OutlineParser object of Node.rb (http://www.troubleshooters.com/projects/Node.rb/index.htm). Once the data is in a Node tree instead of a file, you can use Walker objects and simple callbacks to put massage the data and then output it in any form you'd like, including XML or SQL. If you cannot count on the indentation, you could remove all indentation with a simple sed script, then run a Ruby program to convert every opening brace to a new level of indentation and convert ever closing brace to a previous level of indentation, and then use that conversion through Node.rb's parser. SteveT Steve Litt http://www.troubleshooters.com slitt / troubleshooters.com