title: Calculate percentage across multiple files with awk
body: <p>I have 100 csv files like:</p>
  
  <pre><code>file_city_1 file_city_2 file_city_3 file_city_4
  </code></pre>
  
  <p>City name is variable, there is 25 cities, each city has 4 region. Each of the 4 region contain some statistics like:</p>
  
  <pre><code>parameter1 : number1
  parameter1 : number2
  .....
  parameter50 : number50
  </code></pre>
  
  <p>So I should calculate each region's each parameter percentage in city total for this parameter. So what I want to do is something something like:</p>
  
  <pre><code>file_city_parameter1_total = parameter1_region1 + parameter1_region2 + parameter1_region3 + parameter1_region4
  </code></pre>
  
  <p>Then calculate percentage for this specific parameter for each region:</p>
  
  <pre><code>file_city_region_parameter1_percentage = parameter1_region1 / file_city_parameter1_total * 100 
  </code></pre>
  
  <p>then echo all parameters percentage over total (sum of 4 regions) for a specific region and should do it for regions (all 100 files)</p>
  
  <p>I actually tried multiple codes but I don't want to paste them here as they are way long to read. I defined all parameters separately for each region, parameters, tried different command substitution and nested loop. But stuck at some point. So I'm wondering what is the easiest way to accomplish this work done with awk, grep, sed or anything else.</p>
  
  <p>Thanks. </p>