http://qs321.pair.com?node_id=1227307


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