title: Using sed to change /etc/fstab, Part II
body: <p>I am trying to modify <code>/etc/fstab</code> with <code>sed</code>/<code>awk</code>.  Much like in <a href="https://stackoverflow.com/questions/9118123/using-sed-to-change-etc-fstab">this question</a>, however, the solutions in that question aren't <em>quite</em> working for me.</p>
  
  <p>I need to add the <code>nodev</code> (and <code>nosuid</code>) option to <code>nfs</code> or <code>nfs4</code> mount points.</p>
  
  <p>I have working;</p>
  
  <pre><code>awk '$4!~/nodev/&amp;&amp;$3~"nfs"{$4=$4",nodev"}1' OFS="\t" /etc/fstab &gt; /etc/fstab.tmp &amp;&amp; mv /etc/fstab.tmp /etc/fstab
  
  awk '$4!~/nosuid/&amp;&amp;$3~"nfs"{$4=$4",nosuid"}1' OFS="\t" /etc/fstab &gt; /etc/fstab.tmp &amp;&amp; mv /etc/fstab.tmp /etc/fstab
  </code></pre>
  
  <p>However, it obliterates existing white space and replaces with a single tab.  My question is: <strong>How can I make this change in a less intrusive manner?</strong>  <a href="https://stackoverflow.com/a/9118513/1207760">This answer</a> looked promising, but I don't understand it well enough to adapt it to my use.</p>
  
  <p>I am open to solutions other than <code>sed</code> or <code>awk</code>, but any other tools need to exist in a default Red Hat/CentOS environment (during %post in Kickstart.)</p>