Files
tldr/pages.zh/common/numfmt.md

16 lines
439 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# numfmt
> 将数字转换为人类可读的字符串,反之亦然。
> 更多信息:<https://www.gnu.org/software/coreutils/numfmt>。
- 将 1.5K(国际单位制)转换为 1500
`numfmt --from=si 1.5K`
- 将第 5 列1 索引)转换为 IEC 单位,不转换表头:
`ls -l | numfmt --header=1 --field=5 --to=iec`
- 转换为 IEC 单位,填充 5 个字符,左对齐:
`du -s * | numfmt --to=iec --format="%-5f"`