2018-10-04 18:07:53 +01:00
|
|
|
# numfmt
|
|
|
|
|
|
|
|
> Convert numbers to and from human-readable strings.
|
2021-04-01 16:54:26 +01:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/numfmt>.
|
2018-10-04 18:07:53 +01:00
|
|
|
|
|
|
|
- Convert 1.5K (SI Units) to 1500:
|
|
|
|
|
2024-06-26 16:23:28 +01:00
|
|
|
`numfmt --from=si 1.5K`
|
2018-10-04 18:07:53 +01:00
|
|
|
|
|
|
|
- Convert 5th field (1-indexed) to IEC Units without converting header:
|
|
|
|
|
2024-06-26 16:23:28 +01:00
|
|
|
`ls -l | numfmt --header=1 --field=5 --to=iec`
|
2018-10-04 18:07:53 +01:00
|
|
|
|
|
|
|
- Convert to IEC units, pad with 5 characters, left aligned:
|
|
|
|
|
2024-06-26 16:23:28 +01:00
|
|
|
`du -s * | numfmt --to=iec --format="%-5f"`
|