2018-10-04 13:07:53 -04:00
|
|
|
# numfmt
|
|
|
|
|
|
|
|
> Convert numbers to and from human-readable strings.
|
2025-01-18 18:45:33 +05:30
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/numfmt-invocation.html>.
|
2018-10-04 13:07:53 -04:00
|
|
|
|
|
|
|
- Convert 1.5K (SI Units) to 1500:
|
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`numfmt --from si 1.5K`
|
2018-10-04 13:07:53 -04:00
|
|
|
|
|
|
|
- Convert 5th field (1-indexed) to IEC Units without converting header:
|
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`ls -l | numfmt --header=1 --field 5 --to iec`
|
2018-10-04 13:07:53 -04:00
|
|
|
|
|
|
|
- Convert to IEC units, pad with 5 characters, left aligned:
|
|
|
|
|
2025-03-26 02:30:50 +02:00
|
|
|
`du {{[-s|--summarize]}} * | numfmt --to iec --format "%-5f"`
|