2 edited tags
| link
source | link

Convert / import flat file with multiple records, one variable per line

I am searching for an efficient way using (UNIX) command line tools to read a flat file into a(ny) database, perhaps after first converting to an intermediate structured format, for example XML or csv. The flat file has multiple records with lines containing each a single key and value, such as follows. The number of variables may vary between records and their number and names are only known after reading the input file. (A further complication is, there may be some nesting of repeated variables, but this may be ignored for the time being.)



I have checked answers given for transforming rows to columns and other answers on this site but none seemed to fit. The problem seems similar to reading INI or VCARD files, but I could not find a generic solution; an XSL transformation may be conceivable but was not found. Any pointers would be more than welcome, thanks.