[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Reading CSV
- From: Geoff Leyland <geoff_leyland@...>
- Date: Wed, 4 Dec 2013 07:09:30 +1300
Hi,
What’s the current best option for a CSV (or tab separated, for that matter) file?
I’ve had a look at http://lua-users.org/wiki/CsvUtils and http://lua-users.org/wiki/LuaCsv, searched LuaRocks (nothing came up, but perhaps I’m using the wrong search term) and looked at Penlight’s data.read. As far as I can tell, most solutions either:
- read the whole file in one go (constructing a table of all the values becomes impractical as files get larger)
- read lines with “*l” and so are opinionated about what constitutes a newline
- don’t handle embedded newlines in quoted fields
There’s also an LPeg example, but as I understand it, LPeg works on whole strings, not file streams?
Geoff