views:

73

answers:

2

I need to generate a flat file with several different sections, each with different record structures. All data is delimited text, single line per record. What would be a good delimiting sequence, or mechanism to differentiate sections, given that records can contain line feeds etc. within quoted text fields?

+1  A: 

You haven't specified what you intend to do with the file. What language do you use, etc.

If the file will contain different sections, and different structures, I would suggest using the YAML structure.

There are many libraries that allow for to reading/writing using YAML.

ichiban
@ichiban, it's actually not relevant what language I'm using, as I haven't asked for a code specific suggestion. YAML isn't suitable here, but thanks a ton for pointing it out to me.
ProfK
+1  A: 

Well, provided you are free of the necessity of editing the file with an inferior text editor or that the file be human-readable, you could use one of the four C0 control codes which are ASCII characters 28–31, which are meant for delimiting text records. They just never caught on because of the first two points.

Cirno de Bergerac
The file will be produced and consumed by code in one fell swoop, but during development human readable will be nice. I'm going with two blank lines PLUS an ASCII control code, thanks.
ProfK