tools/zipsize

20 lines
483 B
Text
Raw Normal View History

#!/bin/bash
2024-04-06 03:59:22 +01:00
# this script's output is ugly and I don't care.
awk 'BEGIN{CONVFMT="%.2f"}
{
if ($1 ~ /^[0-9]+$/) {
byte=$1;
if (byte >= 1073741824)
{printf("%.2f GB\t%s\n", byte/1073741824, $4)}
else if (byte >= 1048576)
{printf("%.2f MB\t%s\n", byte/1048576, $4)}
else if (byte >= 1024)
{printf("%.2f KB\t%s\n", byte/1024, $4)}
else
{print $1 " B\t" $4}
}
else {print $0}
}'