title: Converting kB and GB to MB in bash
body: <p>Im using awk and sed to get a list of partitions in table with their size, which I want to use to calculate the daily increment for individual tables. This is the output I have, now Im struggling to convert all of the sizes to MBs. </p>
  
  <p>What would be the best bash way to match the number in the second field and multiply it depending on the "MB" or "GB" string</p>
  
  <pre><code>2017061505,482.46MB,hdfs://user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061505,
  2017061505,722.58MB,hdfs://user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061506,
  2017061507,1.03GB,hdfs://user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061507,
  2017061507,1.25GB,hdfs://user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061508,
  </code></pre>
  
  <p>The desired output would be:</p>
  
  <pre><code>2017061505,482.46MB,hdfs://MORPHEUS/user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061505,
  2017061506,722.58MB,hdfs://MORPHEUS/user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061506,
  2017061507,1030MB,hdfs://MORPHEUS/user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061507,
  2017061508,1250MB,hdfs://MORPHEUS/user/hive/warehouse/cz_prd_ntw_op.db/diameter__24_/pr_comp_ver=0/pr_start_time=2017061508,
  </code></pre>