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