Lew Pitcher wrote:
> On Wednesday November 23 2016 07:18, in comp.unix.shell, "Janis
> Papanagnou" <
janis_pa...@hotmail.com> wrote:
It’s attribution _line_, not attribution novel.
>> On 23.11.2016 12:50,
contr...@gmail.com wrote:
>>>
>>> Is there any way to get df output in Bytes, not in 512-blocks bytes ?
Probably ”512-byte blocks” is meant here.
None of what was mentioned so far can be achieved with POSIX df(1):
<
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/df.html>
However, <
http://ss64.com/osx/df.html> suggests that df(1) on OS X, as
indicated by the “macmini” in the OP, outputs bytes by default (why would
there be “-b” and “-k” options if it would not?).
But although it might not be pretty, the standards-compliant solution
appears to me to be very simple: Multiply all non-percentage numbers by 512.
(export LC_ALL=C; (df -P || df) | awk '
function blockmul (i) {
res = i;
if (match(i, /^[[:digit:]]+$/)) { res *= 512 };
return res;
}
{
printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s %s\n", $1, blockmul($2),
blockmul($3), blockmul($4), $5, blockmul($6), blockmul($7), $8,
$9, $10;
}
')
There is probably a more elegant way, but this WFM.
--
PointedEars
Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.