-4

I need a script that converts a number from bytes to GB (not GiB) and rounds the result to 2 decimal places. How would I go about doing this?

Thanks.

1 Answers1

3
$ n=1832985293598283    
$ echo  $(echo "scale=2; $n/1000000000"  | bc -l)
1832985.29
$ 

Tells bc to calculate $n divided by a billion, with two decimals. bc should be available almost everywhere.

vidarlo
  • 23,497