On Wed, 19 Sep 2007, Jelle Huisman wrote:
Hi all,
I try to merge data from four files in one document. The source files are simple text files, each with 420 numbered lines of text. I have created a simple natural table with cells for the different pieces of data. I would like to make one document with 420 tables, each with the right data from the four source files (so Table 1 with data from line 1 from file One and line 1 from file Two and line 1 from file Three and line 1 from file Four, and next Table 2 with data from line 2 from file One and line 2 from file Two et cetera...) What is the best way to automate this process?
Write a script in your favourite language to create the 420 natural tables. Then call your script from ConTeXt and then use \write18 or \executesystemcommand to run it (See http://wiki.contextgarden.net/executesystemcommand and http://wiki.contextgarden.net/Write18), and then \input the file that is created. You can also do the whole thing in TeX, but IMHO it is not worth the effort. An alternative may be to use LuaTeX, where you write your script in lua, and execute it directly in luatex. This will have a slight speed advantage. Aditya