in reply to Re^2: Separating big numbers with commas
in thread Separating big numbers with commas
I'm not a ksh user, but this script seems to work for me.
===
cat ~/.local/bin/commafy #!/usr/bin/perl -nl $_ =~ s/(\d)(?=(\d{3})+(\D|$))/$1\,/g; print;
===
My usage (to find out that a recent nix build used 18 GB of space):
$ find /nix/store -cmin -150 | perl -nle '$sum+=-s "$_";END{print $sum +}' | commafy 18,025,136,505
2018-12-16 Athanasius added code and paragraph tags
|
---|
In Section
Seekers of Perl Wisdom