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

Decimal separator #300

Open
alvanuffelen opened this issue Feb 10, 2025 · 2 comments
Open

Decimal separator #300

alvanuffelen opened this issue Feb 10, 2025 · 2 comments

Comments

@alvanuffelen
Copy link

alvanuffelen commented Feb 10, 2025

Is there a way to add a thousands separator for columns containing (large) numbers?

echo -ne "col1, col2, col3\na, b, 123456789\nc, d, 987654321" | csvtk pretty
col1    col2    col3
----   -----   ----------
a       b       123456789
c       d       987654321

It would be nice to be able to display numbers with a thousands separator

col1    col2    col3
----   -----   ------------
a       b       123,456,789
c       d       987,654,321
@shenwei356
Copy link
Owner

Looks useful, will do it this weekend probably.

There's no way to do it currently (tried).

shenwei356 added a commit that referenced this issue Feb 13, 2025
@shenwei356
Copy link
Owner

How about this? It simply adds a comma for every 3 numbers.

$  echo -ne "12345\nNA\n12345.12\n1.2e6\n" 
12345
NA
12345.12
1.2e6

$  echo -ne "12345\nNA\n12345.12\n1.2e6\n" | csvtk fmtnum -t
12345
NA
12,345.12
1,200,000

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

No branches or pull requests

2 participants