title: Shell Script Replace a Specified Column with sed
body: <p>I have a example dataset separated by semicolon as below;</p>
  
  <pre><code>123;IZMIR;ZMIR;123
  abc;ANKAR;aaa;999
  AAA;ZMIR;ZMIR;bob
  BBB;ANKR;RRRR;ABC
  </code></pre>
  
  <p>I would like to replace values in a specified column. Lets say I want to change "ZMIR" AS "IZMIR" but only for the third column, the ones on the second column must stay the same. </p>
  
  <p>Desired output is;</p>
  
  <pre><code>123;IZMIR;IZMIR;123
  abc;ANKAR;aaa;999
  AAA;ZMIR;IZMIR;bob
  BBB;ANKR;RRRR;ABC
  </code></pre>
  
  <p>I tried;</p>
  
  <pre><code>sed 's/;ZMIR;/;IZMIR;/' file.txt
  </code></pre>
  
  <p>the problem is that it changes all the values on the file not just the 3rd one. </p>
  
  <p>I also tried;</p>
  
  <pre><code>awk -F";" '{gsub("ZMIR",";IZMIR;",$2)}1'
  </code></pre>
  
  <p>and here it specifies the column but, it somehow adds spaces;</p>
  
  <pre><code>123 I;IZMIR; ZMIR 123
  abc;ANKAR;aaa;999
  AAA ;IZMIR; ZMIR bob
  BBB;ANKR;RRRR;ABC
  </code></pre>