File size distribution: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: added a summary (totals). |
m →{{header|REXX}}: added commas to allow ginormous numbers to be read easier, add output from a non-typical "data" drive. |
||
Line 436:
if g==0 then do; say 'file not found: ' ds; exit 13; end
say ' record size range count '
hdr= '══════════════════
mC=0 /*mC: the maximum count for any range.*/
do t=1 to 2 /*T==1 is used to find the max count.*/
do k=0 to maxL; mC=max(mC, @.k); if t==1 then iterate
select
when k==0 then y= ' zero '
when k==1 then y= ' 1 ──► 9 '
when k==2 then y= ' 10 ──► 99 '
when k==3 then y= ' 100 ──► 999 '
when k==4 then y= ' 1000 ──► 9999 '
otherwise y= '10^'left(k-1,2) "──► 10^"left(k,2) '-1'
end /*select*/
say y || right(commas(@.k),
end /*k*/
end /*y*/
say
'ERASE' dirOut /*perform clean─up (erase a work file).*/
say commas(g) ' files detected,' commas($) " total bytes."
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
commas: parse arg _; do jc=length(_)-3 to 1 by -3; _=insert(',', _, jc); end; return _</lang>
{{out|output|text= when using the default input: (which in this case was the '''C:''' drive.)}}
<pre>
record size range count
══════════════════
zero
1 ──► 9 207 ─
10 ──► 99
100 ──► 999
1000 ──► 9999 25,215 ──────────────────────────────────────────────────────────────────
10^4 ──► 10^5 -1
10^5 ──► 10^6 -1
10^6 ──► 10^7 -1
10^7 ──► 10^8 -1 151 ─
10^8 ──► 10^9 -1 3 ─
10^9 ──► 10^10 -1 1 ─
</pre>
{{out|output|text= when using the (my) '''K:''' drive:}}
<pre>
record size range count
══════════════════ ═════════
zero 30 ─
1 ──► 9 131 ─
10 ──► 99 821 ─
100 ──► 999 3,866 ────────────────────────
1000 ──► 9999 5,962 ─────────────────────────────────────────────────────
10^4 ──► 10^5 -1 6,876 ──────────────────────────────────────────────────────────────────
10^5 ──► 10^6 -1 2,454 ────
10^6 ──► 10^7 -1 239 ─
10^7 ──► 10^8 -1 6 ─
20,385 files detected, 1,625,509,222 total bytes.
</pre>
|