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

How to change to delim from "\x01" to others? #54

Closed
SysuJayce opened this issue Dec 14, 2023 · 2 comments · Fixed by #55
Closed

How to change to delim from "\x01" to others? #54

SysuJayce opened this issue Dec 14, 2023 · 2 comments · Fixed by #55

Comments

@SysuJayce
Copy link

SysuJayce commented Dec 14, 2023

Hello there, I have a csv file with "\x01" as delimiter and I want to use gocsv to change it to others like "," or "\t".

I have tried head input | gocsv delim -i "\x01" -o "\t" > outputbut nothing changed.

What should I do?

@aotimme
Copy link
Owner

aotimme commented Dec 15, 2023

I believe we can put up a fix for this. Would you be able to share a file that has this \x01 delimiter so we can use it to verify a fix works?

aotimme added a commit that referenced this issue Dec 15, 2023
This change makes two changes to how delimiters are specified:
1. It allows other backslash-escaped delimiters, such as those that
represent hexadecimal or unicode characters (like `\x01` per #54).
Previously we had a special case to handle the tab-delimiter `\t`.
2. It will now exit with an error if the provided delimiter does not
evaluate to exactly 1 rune. Previously it would silently accept it,
which is not great since it could lead to some strange behavior for
users.

Fixes #54
@aotimme
Copy link
Owner

aotimme commented Dec 15, 2023

I believe this is fixed in the latest release: https://github.com/aotimme/gocsv/releases/tag/v1.0.4.

If not, please re-open!

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

Successfully merging a pull request may close this issue.

2 participants