I am a Ruby newbie, and would appreciate help with the following to jump-start a project.
1)- How can I read the contents of a text file into a two-dimentional array, such that one dimension are the rows of text and the other dimension are fields that occur on each line as delimited by some character.
Note: A tutorial I'm using shows that I can use the readlines method to create a one-dimensional array, with each line from the source file an element. It seems like I ought to be able to use the same or similar method to include the second dimension (delimited fields in each row).
2)- Say I have text files FileA and FileB. FileA contains a text tag in the somewhere in it called, say, “”. How can I:
- locate the tag <foobar> in FileA and - replace <foobar> with the entire contents of FileB. In short, I want to insert FileB in FileA where the <foobar> tag is, then delete the tag.