3 ms·
'scour' is a little exaggerated, don't you think? Maybe a little, but it is an extra manual step you'd need to take each time you export CSV data, simply becau
by jcl 18y ago
'scour' is a little exaggerated, don't you think?
Maybe a little, but it is an extra manual step you'd need to take each time you export CSV data, simply because the bash parser isn't equipped to handle it. And, as I said, you'd also need to check for quotation marks in the data -- Excel escapes them by doubling them up -- which the bash parser also won't handle as expected. These are not exactly uncommon characters in text data -- hardly extreme edge cases.
...Not that I mean to harp on the issue, but you did describe O'Reilly's statement that parsing CSV is "harder than it sounds" as "complete and utter horseshit". In light of the article's oversights, that strikes me as a little exaggerated. ;)
- nailer 18y agoWe're talking Unix config options and command line parameters. Having a quote in the middle of such a thing is, for me, unheard of. Having a quite around them is common, and shown inside the second example for this reason. I think O'Reilly should provide a solution that works for their audience (primarily system administrators, judging from the books other contents) if they have a chapter on the topic. Preferably in Bash, as that's what the book is focused on. Mentioning specific parsing tools built into Python would also also be of use (other chapters in the same book do pull out other languages if deemed necessary). This chapter stands out as it exists in the TOC and has no code at all, when a very simple solution will handle common admin tasks easily.