Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSV conversion splits string on ":" to become a subfield #2045

Closed
eissar opened this issue May 21, 2024 · 1 comment
Closed

TSV conversion splits string on ":" to become a subfield #2045

eissar opened this issue May 21, 2024 · 1 comment
Labels

Comments

@eissar
Copy link

eissar commented May 21, 2024

similar bug as described in #1947. Apologies if I should've reopened that issue.

Using a colon character ":" creates children when using --input-format='tsv'

"asdf.tsv":

head1    head2
John: Smith    "second itemb"

command:

yq --input-format='tsv' .\asdf.tsv  --output-format='tsv'

outputs:

- head1:
    John: Smith
  head2: second itemb

also, specifying --output-format='csv|yml' outputs: Error: csv encoding only works for arrays of scalars (string/numbers/booleans), child[0] is a !!map

Issue #1947 suggests --csv-auto-parse=f which solves the problem, but the flag doesn't work with --input-format='tsv'

Disabling csv auto parse using --input-format='csv' (works):

yq --input-format='csv' --csv-separator "`t" .\asdf.tsv  --output-format='yaml' --csv-auto-parse=f

outputs:

- head1: 'John: Smith'
  head2: second itemb

disabling csv auto parse using --input-format='tsv':

yq --input-format='tsv' .\asdf.tsv  --output-format='yaml' --csv-auto-parse=f

outputs:

- head1:
    John: Smith
  head2: second itemb
@mikefarah
Copy link
Owner

There's a --tsv-auto-parse flag that you can set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants