yq icon indicating copy to clipboard operation
yq copied to clipboard

Support semicolon (;) as CSV separator

Open DamianFekete opened this issue 1 year ago • 1 comments

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.

DamianFekete avatar Feb 16 '24 12:02 DamianFekete

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

mikefarah avatar Feb 17 '24 08:02 mikefarah

Fixed in 4.42.1

mikefarah avatar Feb 25 '24 22:02 mikefarah