coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

numfmt: won't do grouping in Windows OS

Open Gavin-Holt opened this issue 2 years ago • 3 comments

Hi,

Many thanks for these utilities - especial thanks for the Windows binaries.

I am trying to format numbers as currency in the UK. e.g. £12,000.99

The UK pound character is a problem - so I am happy with $.

From my batch file:

cat.exe data.csv | numfmt.exe -d, --header --field=2-4 --format="$%%'.2f" >> output.txt

I think that numfmt.exe is getting the ' to trigger grouping, but it does not seem to read my locale from the operating system.

Is there a way to force a locale or an environment variable I can set somehow?

For completeness, this is how I get the UK pound sign to display in Notepad.exe:

sed.exe -i s/\$/\xA3/g output.txt

Any help welcome.

Kind Regards Gavin Holt

Gavin-Holt avatar Jan 25 '23 02:01 Gavin-Holt

Grouping has not been implemented yet.

cakebaker avatar Jan 25 '23 07:01 cakebaker

Yep, this might also be related: https://github.com/uutils/coreutils/issues/1280.

Grouping is a bit tricky to implement because it is locale-dependent.

tertsdiepraam avatar Jan 25 '23 08:01 tertsdiepraam

Leaving this open for others to find.

Gavin-Holt avatar Jun 24 '24 18:06 Gavin-Holt