Visidata: [tsv] Problem reading file that contains a CRLF within a quoted cell

Created on 5 Feb 2020  路  5Comments  路  Source: saulpw/visidata

Small description

When I read this TSV file, that has inside cells some CRLF, visidata does not map correctly cells.

Expected result

Using LibreOffice I have no problem

image

Actual result with screenshot

Using VisiData v1.5.2 I have this

image

That TSV does not seem to me wrong, because the CRLFs are inside double quotes.

bug

Most helpful comment

This is the correct solution, as quoted newlines aren't allowed in 'true' tsv files.

All 5 comments

Thank you so much for the detailed bug report @aborruso!

From a glance, the tsv loader code does not seem to support a quotechar.

The csv loader does!

A current workaround, until we have an opportunity to give this issue more attention, is to load these files with the csv loader, and specify a tab delimiter. You can do that:

vd input.tsv -f csv --csv-delimiter=$'\t'

I didn't know about the dollar sign @anjakefala, I always typed ctrl-v to put a literal tab !! nice !!

hi @anjakefala $'\t' is the ANSI C way to write the tab char?

:joy:

Saul taught me this! It blew my mind, too. I asked him how to pass a tab just before commenting on this issue.

From what I understand, the $ tells the shell to interpret \ escapes. Instead of literally taking the "\" as string, it interpets the \t as a backslash'd entity.

This is the correct solution, as quoted newlines aren't allowed in 'true' tsv files.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

geekscrapy picture geekscrapy  路  3Comments

frosencrantz picture frosencrantz  路  3Comments

baogorek picture baogorek  路  3Comments

paulklemm picture paulklemm  路  4Comments

frosencrantz picture frosencrantz  路  4Comments