Re:Q – Run SQL Directly on CSV or TSV Files
by aasasd on Thursday September 22, 2022 @05:52AM
(#32936737)
Are you telling me that awk can correctly identify delimiters inside quoted strings? Escaped quotes inside quoted strings? Newlines inside quoted strings? I.e. that awk actually has a csv parser? Very cool if so.
[ Parent
| on HN ]
Re:Q – Run SQL Directly on CSV or TSV Files
by pphysch on Thursday September 22, 2022 @12:09PM
(#32940955)
Yeah, you can implement a basic FSM and use `next` to handle fake `RS` (e.g. newlines).
I'm not necessarily recommending it, but it's certainly possible and could be portable and really fast to run with a low memory footprint.
Re:Q – Run SQL Directly on CSV or TSV Files
by aasasd on Thursday September 22, 2022 @02:01PM
(#32942456)
Well, awk having a csv parser via the user implementing that parser is not quite what I have in mind when I turn to awk for some quick field splitting—and I don't think it's what others in the thread meant either, as evidenced by the linked site.
Personally I prefer using a readymade and tested library in any language that I might touch, so I can just do my own thing on top. Or, in command line, to use an util that employs such a library. Kind of hope that I'm never so constrained that only awk is available and I can't even spin up Lua.