Skip to content

Is there a problem with this file or a problem with miller? #1485

Closed Answered by aborruso
seancarmody asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @seancarmody there are some errors in that CSV.

Two of these:

  • a few blank lines;
  • Incorrect use of double quotes. If it has them in a cell, you need to apply escape. If you have in a cell lorem "ipsum" sit, a proper CSV must be in this way: "lorem ""ipsum"" sit"

You can correct it in this way:

<IDCKMSTM0S.csv  tail -n +5 | sed  '/^$/d' | mlr --icsvlite --ocsv cat >output.csv
  • skip unnecessary rows;
  • remove blank rows;
  • impose csvlite as input format, which disregards the double-quote escaping rule, and set csv as output to create a fully correct csv, with the correct use of quotation marks

The error message does not help, and perhaps it should be changed. But for that we need to ask @…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@seancarmody
Comment options

Answer selected by seancarmody
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants