title: Edit multiple columns in a line using awk command?
body: <p>I'm trying to edit 3 columns in a file if the value in column 1 equals a specific string. This is my current attempt:</p>
  
  <pre><code>cp file file.copy
  awk -F':' 'OFS=":" { if ($1 == "root1") $2="test"; print}' file.copy&gt;file
  rm file.copy
  </code></pre>
  
  <p>I've only been able to get the awk command working with one column being changed, I want to be able to edit $3 and $8 as well. Is this possible in the same command? Or is it only possible with separate awk commands or with a different command all together?</p>
  
  <p>Edit note: The real command i'll be passing variables to the columns, i.e. $2=$var</p>
  
  <p>It'll be used to edit the /etc/passwd file, sample input/output:</p>
  
  <pre><code>root:$6$fR7Vrjyp$irnF38R/htMSuk0efLSnAten/epf.5v7gfs0q.NcjKcFPeJmB/4TnnmgaAoTUE9.n4p4UyWOgFwB1guJau8AL.:17976::::::
  </code></pre>