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

convert csv to TSV? #1071

Closed
pengyu opened this issue Apr 10, 2020 · 1 comment
Closed

convert csv to TSV? #1071

pengyu opened this issue Apr 10, 2020 · 1 comment
Labels

Comments

@pengyu
Copy link

pengyu commented Apr 10, 2020

csvformat -D $'\t' <<EOF
"a,b","c""d","e
f"
EOF
a,b	"c""d"	"e
f"

In the above output, newline character is still used, and \n is also used.

Can the output be a TSV like this (and "" needs to be escaped as well)?

a,b<TAB>c"d<TAB>e\nf
@jpmckinney
Copy link
Member

TSV just changes commas to tabs, which is what csvformat does.

Your example is invalid CSV because the " character is not escaped properly.

Are you saying you want the newline character to be changed into a literal backslash and n character? That's a very niche requirement, so not something covered by CSV Kit. Otherwise, the newline character needs to be quoted (like it does now).

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