Convert between byte count and “human-readable” string

前端 未结 2 1376
天命终不由人
天命终不由人 2021-02-20 00:48

Is there a shell command that simply converts back and forth between a number string in bytes and the \"human-readable\" number string offered by some commands via the -h

相关标签:
2条回答
  • 2021-02-20 00:49

    There is no standard (cross-platform) tool to do it. But solution using awk is described here

    0 讨论(0)
  • 2021-02-20 00:53

    numfmt

    To:

    echo "163564736" | numfmt --to=iec
    

    From:

    echo "156M" | numfmt --from=iec
    
    0 讨论(0)
提交回复
热议问题