0

I need to pase a text file in this format:

[section A begin]
some lines
more lines
[section 1 begin]
some lines
[section i begin]
some lines
[section i end]
more lines
[section 1 end]
more lines
[section A end]
[section B end]
...
[section B end]

Each section has 1 begin and 1 end tag; the sections may be nested but may not interleaving; the file may be large and cannot be read in memory as a whole.

Question: what is the easist way to parse such files(any open source libraries to use)?

chance
  • 6,307
  • 13
  • 46
  • 70

1 Answers1

0

I suggest you read one line at a time and parse it yourself. It doesn't look very complex.

If the file is too large to read into memory, what do you intend to do with the data?

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130