On 25/10/2023 22:57, Trent W. Buck wrote:
Package: coreutils
Version: 9.1-1
Severity: wishlist
File: /usr/bin/numfmt
Tags: upstream
In India it is common to write large numbers using combinations of
"lakh" / "L" (10⁷) and "crore" / "cr" (10⁵).
https://en.wikipedia.org/wiki/Lakh
https://en.wikipedia.org/wiki/Crore
For example,
According to […] ₹15.3 lakh crore of the ₹15.41 lakh crore in demonetised
bank notes, […]
— https://en.wikipedia.org/wiki/2016_Indian_banknote_demonetisation
When I try to convert these to SI units in my head, I always mess up.
Could numfmt handle this for me?
Something like this (my maths might be wrong!):
$ numfmt --from=auto --to=लाख 15.3T
15.3 lakh crore
$ numfmt --from=auto --to=लाख 1.2G
120 crore
$ numfmt --from=auto --to=लाख 1.2M
12 lakh
$ numfmt --from=लाख --to=si 12 lakh
1.2M
$ numfmt --from=लाख --to=si 15.3 lakh crore
15.3T
Noted in upstream todo.
This is something that would be nice to have in numfmt.
The designator might be better as "indic" rather than "लाख".
The space between number and suffixes would be hard to support.
So I;m thinking something like this would be more achievable:
$ numfmt --from=auto --to=indic 15.3T
15.3Lcr
thanks,
Pádraig