note
Anonymous Monk
<p>I'm not a ksh user, but this script seems to work for me. </p>
<p>===</p>
<c>
cat ~/.local/bin/commafy
#!/usr/bin/perl -nl
$_ =~ s/(\d)(?=(\d{3})+(\D|$))/$1\,/g;
print;
</c>
<p>===</p>
<p>My usage (to find out that a recent nix build used 18 GB of space):</p>
<c>
$ find /nix/store -cmin -150 | perl -nle '$sum+=-s "$_";END{print $sum}' | commafy
18,025,136,505
</c>
<p><small><i>2018-12-16 [Athanasius] added code and paragraph tags</small></p>
110137
1117162
3