--to
Auto-scale output numbers to UNITs; see UNIT below.
An option of numfmtx.
Usage
numfmtx --to=UNIT [NUMBER]...Details
| Short | Long | Value | Default | Meaning |
|---|---|---|---|---|
--to | UNIT | auto-scale output numbers to UNITs; see UNIT below |
Examples
Show a byte count the way people read sizes
numfmtx --to=iec 10485761.0MUse decimal units, as disk makers do
numfmtx --to=si 15000001.5MMake the size column of a listing readable, keeping the header
lsx -l | numfmtx --header --field=5 --to=iecRound sizes down, never overstating them
numfmtx --to=si --round=down 19991.9kAdd a unit and pad the numbers to a column
numfmtx --to=iec --suffix=B --padding=7 1024 2048000 1.0KB
2.0MBConvert the second column of a CSV file
numfmtx -d, --field=2 --to=si < sizes.csvKeep going past values that are not numbers, but say which
numfmtx --invalid=warn --to=si 1000 n/a 2000Help in the terminal
gnux help numfmtx --to