title: How to replace nth field in a csv file with mapped value from another file?
body: <p>I have a csv file in the following format:</p>
  
  <pre><code>23:56:00,5,1,7,99,100,101
  23:56:30,5,1,7,98,199,191
  23:57:00,6,1,6,99,99,98
  23:57:30,5,2,6,97,99,199
  ...
  </code></pre>
  
  <p>And a map file in the following format:</p>
  
  <pre><code>1:10
  2:12
  3:30
  4:aa
  5:16
  6:11
  7:bb
  </code></pre>
  
  <p>What I'm trying to accomplish is to replace the fields in columns 2,3 and 4 in the first csv files with the values they map to in the map file.</p>
  
  <p>For example in the above case the final output I want is this:</p>
  
  <pre><code>23:56:00,16,10,bb,99,100,101
  23:56:30,16,10,bb,98,199,191
  23:57:00,11,10,11,99,99,98
  23:57:30,16,12,11,97,99,199
  </code></pre>
  
  <p>What would be the best way to do this? I was trying to figure out a way using awk/sed but I'm not sure how to access multiple files inside awk, and if that is even the best way to do this. There will be a lot of repetitions since its a large file so I don't think checking for a mapping each time is the right way to do this. </p>
  
  <p>Is there a way to store the map in to a hash table inside the shell script, and then replace using the hash mapping? </p>