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

Support semicolon (;) as CSV separator #1950

Closed
DamianFekete opened this issue Feb 16, 2024 · 2 comments
Closed

Support semicolon (;) as CSV separator #1950

DamianFekete opened this issue Feb 16, 2024 · 2 comments

Comments

@DamianFekete
Copy link

Please describe your feature request.
I wish I could use yq to parse CSV files where fields are separated by semicolons instead of commas.

Describe the solution you'd like
If we have input.csv like:

Header A;Header B
A1;B1
A2;B2

And we run a command:

yq -p csv -o json --csv-separator ; input.csv
# autodetection (maybe)
yq -p csv -o json input.csv

it could output

[
  {
    "Header A": "A1",
    "Header B": "B1"
  },
  {
    "Header A": "A2",
    "Header B": "B2"
  }
]

Describe alternatives you've considered
Using another tool

Additional context
Different locales have a different field separator than comma, as comma may be used for numbers instead of the English decimal point.

@mikefarah
Copy link
Owner

I like it, will be available in the next release (no auto-detection though sorry)

@mikefarah
Copy link
Owner

Fixed in 4.42.1

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

No branches or pull requests

2 participants