title: Unix command to replace first column of a .csv file
body: <p>I want a unix command (that I will call in a ControlM job) that changes the value of the first column of my .csv file (not the header line), with the date of the previous day (expected format : <code>YYYY-MM-DD</code>).</p>
  
  <p>I tried many commands but none of them do want I want : </p>
  
  <pre><code>tmp=$(mktemp) &amp;&amp; awk -F\| -v val=`date -d yesterday +%F` 'NR&gt;1 {gsub($1,val)}' file.csv &gt; "$tmp" &amp;&amp; mv "$tmp" file.csv
  </code></pre>
  
  <p>or : </p>
  
  <pre><code>awk -F\| -v val=`date -d yesterday +%F` '{gsub($1, val)}1' file.csv
  </code></pre>
  
  <p>even tried gensub but not working.</p>
  
  <p>Example of what I want :
  Input : </p>
  
  <pre><code>VALUE_DATE;TRADE_DATE;DESCR1;DESCR2
  2019-03-05;2017-11-15;BRIDGE;HELLO
  2019-03-05;2018-03-17;WORK;DATA
  </code></pre>
  
  <p>Output I want (as today is 2019-03-07):</p>
  
  <pre><code>VALUE_DATE;TRADE_DATE;DESCR1;DESCR2
  2019-03-06;2017-11-15;BRIDGE;HELLO
  2019-03-06;2018-03-17;WORK;DATA
  </code></pre>
  
  <p>Can you help please and give me examples of commands that should work, I'm not finding a solution.</p>
  
  <p>Thanks a lot</p>