miller icon indicating copy to clipboard operation
miller copied to clipboard

Thousands separator

Open agguser opened this issue 3 years ago • 2 comments

It seems that printf's thousands separator flag (') is not supported, e.g.

$ echo '12345,12345.67' | mlr --c2p -N format-values -i "%'d" -f "%'.2f"
1     2
12345 12345.67

. Expected output is

1      2
12,345 12,345.67

. How to get this?

agguser avatar Oct 26 '20 10:10 agguser

Workaround:

$ echo '12345,12345.67' | mlr --c2t -N cat |
   numfmt -d $'\t' --field=1,2 --grouping --invalid=ignore | 
   column -t -s $'\t'
12,345  12,345.67

agguser avatar Oct 28 '20 02:10 agguser

Wondering how locale-dependent that would turn out to be, since different countries use different characters to that purpose... :thinking:

trantor avatar Apr 27 '21 18:04 trantor