title: calculate percentage between columns in bash?
body: <p>I have long tab formatted file with many columns, i would like to calculate % between two columns (3rd and 4rth) and print this % with correspondence numbers with this format (%46.00). </p>
  
  <p>input:</p>
  
  <pre><code>file1   323     434     45      767     254235  275     2345    467
  file1   294     584     43      7457    254565  345     235445  4635
  file1   224     524     4343    12457   2542165 345     124445  41257
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>file1   323     434(134.37%)    45(13.93%)      767     254235  275     2345    467
  file1   294     584(198.64%)    43(14.63%)      7457    254565  345     235445  4635
  file1   224     524(233.93%)    4343(1938.84%)  12457   2542165 345     124445  41257
  </code></pre>
  
  <p>i tried:</p>
  
  <pre><code>cat test_file.txt |  awk '{printf "%s (%.2f%)\n",$0,($4/$2)*100}' OFS="\t" | awk '{printf "%s (%.2f%)\n",$0,($3/$2)*100}' | awk '{print $1,$2,$3,$11,$4,$10,$5,$6,$7,$8,$9}' - | sed 's/ (/(/g' | sed 's/ /\t/g' &gt;out.txt
  </code></pre>
  
  <p>It works but I want something sort-cut of this.</p>