title: Convert timestamps when viewing logfile output to UTC offset using awk
body: <p>I have a file with timestamps in format:<br>
  <code>2020-06-10 04:51:34.572 INFO: [17] Log message</code></p>
  
  <p>I'd like to be able to <strong>view</strong> the output in <strong>UTC+{n}</strong></p>
  
  <p>If tried:</p>
  
  <pre class="lang-sh prettyprint-override"><code>awk  '{
    #for(timefield = 2;timefield&lt;=NF;timefield++)
    timefield = 2
  
          #cmd = "date --date=\x27"TZ=UTC+7\" \"" $timefield "\"x27"
          #cmd = "date --date=\"TZ=UTC+7\" "" $timefield"
          cmd = "date --date=\"TZ=Europe/London\" "" $timefield"
  
  #  if($timefield ~ /[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}/) {
          while(cmd | getline line) {
        sub($timefield,line,$0)
      }
     print
  }'
  </code></pre>
  
  <p>But am getting <code>awk: line 12: runaway regular expression /} ...</code></p>
  
  <p><strong>UPDATE:</strong><br>
  Having a lot of difficulties working out the correct <em>quoting</em>.</p>
  
  <p>The correct GNU date syntax to get the timezone conversion is:</p>
  
  <pre class="lang-sh prettyprint-override"><code>~# date --date='TZ="Asia/Bangkok" 2020-06-10 03:19:16.222'
  Tue Jun  9 20:19:16 UTC 2020
  </code></pre>
  
  <p>Notice the single quote ("'") in <code>--date='</code> section. How do I correctly quote this within the <code>awk cmd</code> command?</p>